Просмотр файла mafia/who.php

Размер файла: 8.29Kb
<?
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\">Can not connect to MySQL</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\">error select the database...</p>
</card>
</wml>");
          
if(isset($us)){
$us=trim($us);       
if($us==""){          
          echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">\n";
echo "<wml>\n";
echo "<card id=\"error\" title=\"error\" ontimer=\"index.php?ref=$ref\"><timer value=\"15\"/>\n";
echo "<p align=\"center\">\n";
echo "User was not found\n";
echo "</p>\n";
echo "</card>\n";
echo "</wml>\n";
mysql_close ($link);
exit;          
}
}          
          if(isset($id)){ 
        $result = @mysql_query ("Select * from mafusers where id='".$id."'");    
        } 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 * from mafusers where latuser = '".$latuser."'"); 
    } else {
   $result = mysql_query ("select * from mafusers where ruser = '".$ruser."'");
    }
    }       
            if (mysql_affected_rows() == 0) {
          echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">\n";
echo "<wml>\n";
echo "<card id=\"error\" title=\"error\" ontimer=\"index.php?ref=$ref\"><timer value=\"15\"/>\n";
echo "<p align=\"center\">\n";
echo "User was not found\n";
echo "</p>\n";
echo "</card>\n";
echo "</wml>\n";
mysql_close ($link);
exit;
}

if (!isset($rm)) $rm =1;
$rmaf = "maf".$rm;   
$ringame = "ingame".$rm;            

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


if (($row["posts"]>=1000)&&($row["level"]<1)){
$row["level"] = 1; $row["status"] = "Продвинутый пользователь";
mysql_query ("UPDATE mafusers SET status = '".$row["status"]."', level = '".$row["level"]."' WHERE id = '".$id."'");
}  
if (($row["posts"]>=3000)&&($row["level"]<2)){
$row["level"] = 2; $row["status"] = "Чаттер";
mysql_query ("UPDATE mafusers SET status = '".$row["status"]."', level = '".$row["level"]."' WHERE id = '".$id."'");
}  
if (($row["posts"]>=7000)&&($row["level"]<3)){
$row["level"] = 3; $row["status"] = "Тусовщик";
mysql_query ("UPDATE mafusers SET status = '".$row["status"]."', level = '".$row["level"]."' WHERE id = '".$id."'");
} 
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">\n";
echo "<wml>\n";
echo "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>\n";
echo "<card id=\"who\" title=\"Кто здесь?\">\n";
echo "<p>\n";                          
   
$tm = time()-300;
$ingame = "";
$outgame = "";
$res = @mysql_query ("Select * from $rmaf 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";
echo "<b>Р’ РёРіСЂРµ:</b><br/>\n";

for ($k = 1; $k < $kol; $k++){    
       $lines = mysql_fetch_array ($res);
       $user = $lines["who"];
       $user_id = $lines["usid"];
       $r = mysql_query("select * from $ringame 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 "$ingame<br/>\n";
echo "<br/><b>Р’РЅРµ РёРіСЂС‹:</b><br/>\n";
echo "$outgame";

echo "<br/>*******<br/>\n";
echo "<a href=\"maf.php?id=$id&amp;ps=$ps&amp;rm=$rm&amp;ref=$ref\">К Мафу</a><br/>\n";

echo "</p>\n";
echo "</card>\n";
echo "</wml>\n";
?>