<?
list($msec,$sec)=explode(chr(32),microtime());$HeadTime=$sec+$msec;
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=\"error...\" 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['fsize'] == "small") { $fsize1 = "<small>"; $fsize2 = "</small>"; }
elseif($row['fsize'] == "big") { $fsize1 = "<big>"; $fsize2 = "</big>"; }
else { $fsize1 = ""; $fsize2 = ""; }
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."';");
}
for ($n = 0; $n <= 10; $n++){
$room = "room".$n;
$tm = time()-300;
$r = @mysql_query ("Select who from $room WHERE id > '".$tm."' group by who order by id desc;");
$asnum = mysql_affected_rows();
$siz[$n] = $asnum-1;
@$kol = $kol + $asnum-1;
}
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=\"Kтo гдe?($kol)\">";
echo "<p align=\"left\">";
echo $fsize1;
//Мафия
$tm = time()-300;
$ingame = "";
$outgame = "";
$res = @mysql_query ("Select * from maf1 WHERE id > '".$tm."' group by usid order by id desc");
$kol = mysql_affected_rows();
$lines = mysql_fetch_array ($res); //Топик - не нужен
//if($num!=0)echo "<br/>\n";
$roomselect21 = @mysql_query ("Select name from rooms where rm=21");
$rooms21 = @mysql_fetch_array($roomselect21);
$roomname21=$rooms21["name"];
for ($k = 1; $k < $kol; $k++){
$lines = mysql_fetch_array ($res);
$user = $lines["who"];
$user_id = $lines["usid"];
$r = mysql_query("select * from ingame1 WHERE gamer_id = '".$user_id."'");
$a = mysql_fetch_array($r);
$id_in_game = $a["id_in_game"];
if (mysql_affected_rows()!=0) $ingame = $ingame."$user($id_in_game), "; else $outgame = $outgame."$user, ";
}
unset($lines);
echo "<a href=\"maf.php?id=$id&ps=$ps&rm=1&ref=$ref\">$roomname21(".($kol-1)."):</a><br/>\n";
echo "<b>Р’ РёРіСЂРµ:</b><br/>\n";
echo "$ingame<br/>\n";
echo "<b>Р’РЅРµ РёРіСЂС‹:</b><br/>\n";
echo "$outgame<br/>\n";
echo "---<br/>";
for ($num = 0; $num <= 9; $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);
$lines = mysql_fetch_array ($res); //Топик - не нужен
$roomselect = @mysql_query ("Select name from rooms where rm=$num");
$rooms = @mysql_fetch_array($roomselect);
$roomname=$rooms["name"];
if($num==9) {
echo "<a href=\"anlim.php?id=$id&ps=$ps&rm=$num&ref=$ref\">$roomname(".($kol-1)."):</a><br/>";
} else {
echo "<a href=\"chat.php?id=$id&ps=$ps&rm=$num&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);
}
if ($id=="100"){
$num = "10";
$roomselect = @mysql_query ("Select name from rooms where rm=$num");
$rooms = @mysql_fetch_array($roomselect);
$roomname=$rooms["name"];
{
$room = "room".$num;
$tm = time()-300;
$res = @mysql_query ("Select who,hid,pwd from $room WHERE id > '".$tm."' group by who order by id desc");
echo " ".mysql_error()." ";
$kolin = mysql_affected_rows();
echo "<a href=\"intim.php?id=$id&ps=$ps&rm=$num&ref=$ref\">$roomname(".($kolin-1)."):</a><br/>";
$lines = mysql_fetch_array ($res);
for ($k = 1; $k < $kol; $k++){
$lines = mysql_fetch_array ($res);
$user = $lines["who"];
$hd = $lines["hid"];
$pwd = $lines["pwd"];
if ($hd != 1)echo "$user($pwd)";
else echo "$user(!)($pwd)";
if (($k+1) != $kol) print ', ';
}
if($kol>1)
echo "<br/>";
unset($lines);
}
}
$kolv=$kolp+$kol+$kol_all+$kols-1;
print "<b>Всего: ".$kolv."</b><br/>";
echo "---<br/>";
if ((isset($rm))&&($rm!="")&&(!isset($pwd))) echo "<a href=\"chat.php?id=$id&ps=$ps&rm=$rm&ref=$ref\">В чат</a><br/>\n";
else if ((isset($rm))&&($rm!="")&&(isset($pwd))) echo "<a href=\"chat.php?id=$id&ps=$ps&rm=$rm&pwd=$pwd&ref=$ref\">В чат</a><br/>";
echo "<a href=\"enter.php?id=$id&ps=$ps&ref=$ref\">Прихожая</a><br/>";
echo $fsize2;
echo "</p></card></wml>";
?>