Просмотр файла enter.php

Размер файла: 8.95Kb
<?

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=\"&#x041E;&#x0448;&#x0438;&#x0431;&#x043A;&#x0430;\" 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;

}



$row = mysql_fetch_array ($result);

$id = $row["id"];

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 "<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;

}



//"?ы®¦е­ЁеЌЉ
if (($row["credits"]>=1000)&&($row["level"]==0)){

$row["level"] = 1; $row["status"] = "Житель";

mysql_query ("UPDATE mafusers SET status = '".$row["status"]."', level = '".$row["level"]."' WHERE id = '".$id."'");

}

if (($row["credits"]>=10000)&&($row["level"]<2)){

$row["level"] = 2; $row["status"] = "Почетный горожанин";

mysql_query ("UPDATE mafusers SET status = '".$row["status"]."', level = '".$row["level"]."' WHERE id = '".$id."'");

}

if (($row["credits"]>=100000)&&($row["level"]<3)){

$row["level"] = 3; $row["status"] = "Представитель власти";

mysql_query ("UPDATE mafusers SET status = '".$row["status"]."', level = '".$row["level"]."' WHERE id = '".$id."'");

}



for ($i=1;$i<=3;$i++){

$rmaf = "maf".$i;

$tm = time()-300;

mysql_query("select * from $rmaf WHERE id > '".$tm."' group by usid order by id desc");



$sm[$i] = mysql_affected_rows()-1;

@$kol = $kol + $sm[$i];

}



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=\"enter\" title=\"Мафия\" >\n";
echo "<p align=\"center\">\n";
echo "<small><b>Клоны в мафии запрещены!</b></small><br/>\n";
echo "<a href=\"rules1.php?id=$id&amp;ps=$ps\">Правила игры</a><br/>\n";
echo "<a href=\"top10.php?id=$id&amp;ps=$ps\">Автора<br/></a>\n";
echo "-------<br/>\n";
echo "<b>Куда направимся?</b><br/>\n";
echo "<a href=\"maf.php?id=$id&amp;ps=$ps&amp;rm=1&amp;ref=$ref\">Русская мафия($sm[1])</a><br/>\n"; 
echo "<a href=\"maf.php?id=$id&amp;ps=$ps&amp;rm=2&amp;ref=$ref\">Мафия Сан-Франциско($sm[2])</a><br/>\n";
echo "<a href=\"maf.php?id=$id&amp;ps=$ps&amp;rm=3&amp;ref=$ref\">Японская мафия($sm[3])<br/></a>\n";
if($row["level"]==7)echo "-------<br/>\n <a href=\"apanel.php?id=$id&amp;ps=$ps&amp;ref=$ref\">Apanel</a><br/>\n";
echo "-------<br/>\n";
echo "<a href=\"profile.php?id=$id&amp;ps=$ps&amp;ref=$ref\">Профайл</a><br/>\n";
echo "<a href=\"change.php?id=$id&amp;ps=$ps&amp;ref=$ref\">Настройки игры</a><br/>\n";
echo "<a href=\"ignorlist.php?id=$id&amp;ps=$ps&amp;ref=$ref\">Р?РіРЅРѕСЂ-лист</a><br/>\n";
echo "-------<br/>\n";
echo "<a href=\"http://rom.rus-hoster.net\">rom.rus-hoster.net</a>\n";
echo "</p>\n";
echo "</card>\n";
echo "</wml>\n";
mysql_close ($link);
$f = fopen("kol.dat", "a+");
flock($f,LOCK_EX);
ftruncate($f,0);
fwrite($f, $kol);
fflush($f);
flock($f,LOCK_UN);
fclose($f);
?>