View file 4at2/ch/pos.php

File size: 8.93Kb
<?
header("Cache-Control: no-cache");
header("Content-type: text/vnd.wap.wml");
$ref=rand(10000,1000000);

require("inc.php"); 

$link = @mysql_pconnect ($MySQL_Hostname, $MySQL_Username, $MySQL_Password)
or die ("<wml><card id=\"error\" title=\"error\">
<do type=\"prev\" label=\"Back\"><prev/></do><p align=\"center\"><small>Can not connect to MySQL</small></p>
</card></wml>");

@mysql_select_db($MySQLDatabasename) or die ("<wml><card id=\"error\" title=\"error\">
<do type=\"prev\" label=\"Back\"><prev/></do><p align=\"center\"><small>error select the database...</small></p>
</card></wml>");

if(isset($us))
{
$us=trim($us);
if($us=="")
{
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">";
echo "<wml>";
echo "<card id=\"error\" title=\"error\" ontimer=\"index.php?ref=$ref\"><timer value=\"15\"/>";
echo "<p align=\"center\"><small>";
echo "User was not found";
echo "</small></p></card></wml>";
mysql_close ($link);
exit;
}
}

if(isset($id))
{
$result = @mysql_query ("Select id,pass,level,posts,fsize from users where id='".$id."' LIMIT 1;");
} else
{
 function rus_to_k($str){
				$str = str_replace("Р°","a",$str);
				$str = str_replace("Р±","b",$str);
				$str = str_replace("РІ","v",$str);
				$str = str_replace("Рі","g",$str);
				$str = str_replace("Рґ","d",$str);
				$str = str_replace("Рµ","e",$str);
				$str = str_replace("С‘","e",$str);
				$str = str_replace("Р¶","j",$str);
				$str = str_replace("Р·","z",$str);
				$str = str_replace("Рё","i",$str);
				$str = str_replace("Р№","y",$str);
				$str = str_replace("Рє","k",$str);
				$str = str_replace("Р»","l",$str);
				$str = str_replace("Рј","m",$str);
				$str = str_replace("РЅ","n",$str);
				$str = str_replace("Рѕ","o",$str);
				$str = str_replace("Рї","p",$str);
				$str = str_replace("СЂ","r",$str);
				$str = str_replace("СЃ","s",$str);
				$str = str_replace("С‚","t",$str);
				$str = str_replace("Сѓ","u",$str);
				$str = str_replace("С„","f",$str);
				$str = str_replace("С…","h",$str);
				$str = str_replace("С‡","c",$str);
				$str = str_replace("С†","q",$str);//ч
				$str = str_replace("С€","w",$str);
				$str = str_replace("С‰",">",$str);//щ
				$str = str_replace("СЊ","<",$str);//ъ
				$str = str_replace("С‹","x",$str);//ы
				$str = str_replace("СЉ",".",$str);//ь
				$str = str_replace("СЌ",":",$str);//э
				$str = str_replace("СЋ",";",$str);//ю
				$str = str_replace("СЏ","}",$str);//я
				$str = str_replace("Рђ","a",$str);
				$str = str_replace("Р‘","b",$str);
				$str = str_replace("Р’","v",$str);
				$str = str_replace("Р“","g",$str);
				$str = str_replace("Р”","d",$str);
				$str = str_replace("Р•","e",$str);
				$str = str_replace("РЃ","e",$str);
				$str = str_replace("Р–","j",$str);
				$str = str_replace("Р—","z",$str);
				$str = str_replace("Р?","i",$str);
				$str = str_replace("Р™","y",$str);
				$str = str_replace("Рљ","k",$str);
				$str = str_replace("Р›","l",$str);
				$str = str_replace("Рњ","m",$str);
				$str = str_replace("Рќ","n",$str);
				$str = str_replace("Рћ","o",$str);
				$str = str_replace("Рџ","p",$str);
				$str = str_replace("Р ","r",$str);
				$str = str_replace("РЎ","s",$str);
				$str = str_replace("Рў","t",$str);
				$str = str_replace("РЈ","u",$str);
				$str = str_replace("Р¤","f",$str);
				$str = str_replace("РҐ","h",$str);
				$str = str_replace("Р§","c",$str);
				$str = str_replace("Р¦","q",$str);
				$str = str_replace("РЁ","w",$str);
				$str = str_replace("Р©",">",$str);
				$str = str_replace("Р¬","<",$str);
				$str = str_replace("Р«","x",$str);
				$str = str_replace("РЄ",".",$str);
				$str = str_replace("Р­",":",$str);
				$str = str_replace("Р®",";",$str);
				$str = str_replace("РЇ","}",$str);
				return $str;
				}

$latuser=strtolower($us);
$ruser = rus_to_k($us);
if($ruser==$us){
$result = mysql_query ("Select id,pass,level,posts,fsize from users where latuser = '".$latuser."' LIMIT 1;"); 
} else {
$result = mysql_query ("select id,pass,level,posts,fsize from users where ruser = '".$ruser."' LIMIT 1;");
}
}
if (mysql_affected_rows() == 0)
{
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">";
echo "<wml>";
echo "<card id=\"error\" title=\"error\" ontimer=\"index.php?ref=$ref\"><timer value=\"15\"/>";
echo "<p align=\"center\"><small>";
echo "User was not found";
echo "</small></p></card></wml>";
mysql_close ($link);
exit;
}

$row = mysql_fetch_array ($result);

if ($ps !== $row["pass"])
{
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">";
echo "<wml>";
echo "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>";
echo "<card id=\"error\" title=\"&#x041E;&#x0448;&#x0438;&#x0431;&#x043A;&#x0430;\" ontimer=\"index.php?ref=$ref\"><timer value=\"15\"/>";
echo "<p align=\"center\"><small>";
echo "Your login failed";
echo "</small></p></card></wml>";
mysql_close($link);
exit;
}

if (($row["posts"]>=1000)&&($row["level"]<1)){
$levelselect = @mysql_query ("Select name from levels where level=1");
$levels = @mysql_fetch_array($levelselect);
$levelname = $levels["name"];
$row["level"] = 1; $row["status"] = "".$levelname."";
mysql_query ("UPDATE users SET status = '".$row["status"]."', level = '".$row["level"]."' WHERE id = '".$id."';");
}
if (($row["posts"]>=3000)&&($row["level"]<2)){
$levelselect = @mysql_query ("Select name from levels where level=2");
$levels = @mysql_fetch_array($levelselect);
$levelname = $levels["name"];
$row["level"] = 2; $row["status"] = "".$levelname."";
mysql_query ("UPDATE users SET status = '".$row["status"]."', level = '".$row["level"]."' WHERE id = '".$id."';");
}
$levelselect = @mysql_query ("Select name from levels where level=3");
$levels = @mysql_fetch_array($levelselect);
$levelname = $levels["name"];
if (($row["posts"]>=7000)&&($row["level"]<3)){
$row["level"] = 3; $row["status"] = "".$levelname."";
mysql_query ("UPDATE users SET status = '".$row["status"]."', level = '".$row["level"]."' WHERE id = '".$id."';");
}

if($row['fsize'] == "small") { $fsize1 = "<small>"; $fsize2 = "</small>"; }
elseif($row['fsize'] == "big") { $fsize1 = "<big>"; $fsize2 = "</big>"; }
else { $fsize1 = ""; $fsize2 = ""; }

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">";
echo "<wml>";
echo "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>";
echo "<card id=\"who\" title=\"Посольства\">";
echo "<p align=\"left\">";
echo $fsize1;

for ($s = 0; $s <= 10; $s++){
$room = "room".$s;
$tmr = time()-300;
$pr = @mysql_query ("Select who from $room WHERE id > '".$tmr."' group by who order by id desc;");
$asnums = mysql_affected_rows();
$sizn[$s] = $asnums-1;
@$kolp = $kolp + $asnums-1;
}
echo "<a href=\"enter.php?id=$id&amp;ps=$ps&amp;ref=$ref\">Основные комнаты($kolp):</a><br/>";
echo "---<br/>";
echo "<u>Посольства:</u><br/>";
echo "---<br/>";

for ($num = 11; $num <= 20; $num++)
{
$room = "room".$num;
$tm = time()-300;
$res = @mysql_query ("Select who,hid from $room WHERE id > '".$tm."' group by who order by id desc");
echo " ".mysql_error()." ";
$kol = mysql_affected_rows();
$kol_all += ($kol-1);

$roomselect = @mysql_query ("Select name from rooms where rm=$num");
$rooms = @mysql_fetch_array($roomselect);
$roomname=$rooms["name"];

$lines = mysql_fetch_array ($res);	

echo "<a href=\"chat.php?id=$id&amp;ps=$ps&amp;rm=$num&amp;ref=$ref\">$roomname(".($kol-1)."):</a><br/>";

for ($k = 1; $k < $kol; $k++)
{
$lines = mysql_fetch_array ($res);
$user = $lines["who"];
$hd = $lines["hid"];
if ($hd != 1) echo "$user";
else if ($row["level"] > 6) echo "$user(invisible)";
if (($k+1) != $kol) print ', ';
}
if($kol>1)
echo "<br/>";
unset($lines);
}
$tm = time()-300;
$res = @mysql_query ("Select * from maf1 WHERE id > '".$tm."' group by usid order by id desc");
$kol = mysql_affected_rows(); 
@$kolm = $kolm + $kol-1;
$lines = mysql_fetch_array ($res);    //Топик - не нужен
$roomselect21 = @mysql_query ("Select name from rooms where rm=21");
$rooms21 = @mysql_fetch_array($roomselect21);
$roomname21=$rooms21["name"];
if($num!=0)echo "---<br/>\n";
echo "<a href=\"maf.php?id=$id&amp;ps=$ps&amp;rm=1&amp;ref=$ref\">$roomname21(".$kolm."):</a><br/>\n";
echo "---<br/>";
$vsego = $kolp + $kol_all + $kolm;
print '<b>Всего: '.$vsego.'</b><br/>';
echo "---<br/>";
if (isset($rm)) echo "<a href=\"chat.php?id=$id&amp;ps=$ps&amp;rm=$rm&amp;ref=$ref\">В чат</a><br/>";
print '<a href="enter.php?id='.$id.'&amp;ps='.$ps.'&amp;ref='.$ref.'">Прихожая</a><br/>';
echo $fsize2;
echo "</p></card></wml>";

?>