<?php
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>");
$result = @mysql_query ("Select user,pass,level,user_ip,user_soft from mafusers where id='".$id."'");
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=\"Ошибка\" 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);
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=\"Ошибка\" ontimer=\"index.php?ref=$ref\"><timer value=\"10\"/>\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["level"] < 7)
{
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\">\n";
echo "<p align=\"center\">\n";
echo "У вас нет прав доступа!\n";
echo "</p>\n";
echo "</card>\n";
echo "</wml>\n";
mysql_close ($link);
exit;
}
$us=$row["user"];
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;
}
$fi = fopen("admpanel.dat", "a+");
$dat = date ("(H:i)d F");
$lst = "$us visited apanel $dat, his ip: $REMOTE_ADDR, user agent: $HTTP_USER_AGENT";
fwrite($fi, "$lst\n");
fwrite($fi, "************\n");
fflush($fi);
fclose($fi);
//Конец записи
if(!isset($go))
{
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=\"apanel\" title=\"Apanel\">\n";
echo "<p mode=\"wrap\">\n";
$time = date("H:i");
echo "<b>[Система]</b>($time)>здарова, $us!<br/><br/>\n";
echo "Ник юзера:<br/>\n";
echo "<input name=\"nick$ref\" title=\"nick\"/><br/>\n";
echo "<anchor title=\"go\">Апдейт<go href=\"apanel.php?go=view&id=$id&ps=$ps\" method=\"post\">\n";
echo "<postfield name=\"nick\" value=\"$(nick$ref)\"/>\n";
echo "</go></anchor><br/>\n";
echo "*******<br/>\n";
echo "<b>РџРёРЅРѕРє</b><br/>\n";
echo "На сколько (мин)<br/>\n";
echo "<input name=\"wtime$ref\" maxlength=\"3\" title=\"vremya\" format=\"*N\"/><br/>\n";
echo "Причина<br/>\n";
echo "<input name=\"whykik$ref\" maxlength=\"200\" title=\"whykik\"/><br/>\n";
echo "<anchor title=\"go\">Пнуть засранца<go href=\"kick.php?go=pni&id=$id&ps=$ps&ref=$ref\" method=\"post\">\n";
echo "<postfield name=\"nick\" value=\"$(nick$ref)\"/>\n";
echo "<postfield name=\"wtime\" value=\"$(wtime$ref)\"/>\n";
echo "<postfield name=\"whykik\" value=\"$(whykik$ref)\"/>\n";
echo "</go></anchor><br/>\n";
echo "*******<br/>\n";
echo "<anchor title=\"go\">Забанить<go href=\"bann.php?id=$id&ps=$ps&ref=$ref\" method=\"post\">\n";
echo "<postfield name=\"nick\" value=\"$(nick$ref)\"/>\n";
echo "</go></anchor><br/>\n";
echo "*******<br/>\n";
echo "<a href=\"erase.php?id=$id&ps=$ps&ref=$ref\">Удалить всех РёР· РџР?</a><br/>\n";
echo "<a href=\"clear.php?id=$id&ps=$ps&ref=$ref\">Чистка комнат</a><br/>\n";
echo "*******<br/>\n";
echo "<a href=\"enter.php?id=$id&ps=$ps&ref=$ref\">На улицу</a><br/>\n";
echo "</p>\n";
echo "</card>\n";
echo "</wml>\n";
mysql_close ($link);
exit;
}
if(@$go == "view")
{
$nick=trim($nick);
if($nick=="")$nick=0;
$latuser=strtolower($nick);
$ruser = rus_to_k($nick);
if($ruser==$nick){
$result = mysql_query ("Select id,user,pass,posts,status,level,inv from mafusers where latuser = '".$latuser."'");
} else {
$result = mysql_query ("select id,user,pass,posts,status,level,inv 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 "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>\n";
echo "<card id=\"error\" title=\"error\" ontimer=\"apanel.php?id=$id&ps=$ps&ref=$ref\"><timer value=\"10\"/>\n";
echo "<p align=\"center\">\n";
echo "Нет такого юзера\n";
echo "</p>\n";
echo "</card>\n";
echo "</wml>\n";
mysql_close ($link);
exit;
}
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=\"update\" title=\"Update\">\n";
echo "<p >\n";
$row = mysql_fetch_array ($result);
echo "РќРёРє:<br/>\n";
echo "<input name=\"upnick$ref\" value=\"$row[user]\" title=\"nick\"/><br/>\n";
echo "Пароль:<br/>\n";
echo "<input name=\"upass$ref\" value=\"$row[pass]\" title=\"upass\"/><br/>\n";
echo "А постов та:<br/>\n";
echo "<input name=\"posts$ref\" value=\"$row[posts]\" title=\"posts\"/><br/>\n";
echo "Статус:<br/>\n";
echo "<input name=\"status$ref\" value=\"$row[status]\" title=\"status\"/><br/>\n";
echo "Невидимость:<br/>\n";
echo "<select name=\"inv$ref\">\n";
if ($row["inv"] == 0)echo "<option value=\"0\">Отключена</option>\n";
elseif ($row["inv"] == 1)echo "<option value=\"1\">Включена</option>\n";
elseif ($row["inv"] == 2)echo "<option value=\"2\">Полный игнор</option>\n";
if ($row["inv"]!=0) echo "<option value=\"0\">Отключена</option>\n";
if ($row["inv"]!=1) echo "<option value=\"1\">Включена</option>\n";
if ($row["inv"]!=2) echo "<option value=\"2\">Полный игнор</option>\n";
echo "</select><br/>\n";
echo "Уровень:<br/>\n";
echo "<select name=\"level$ref\">\n";
if($row["level"] === "0")echo "<option value=\"0\">Пользователь</option>\n";
elseif($row["level"] === "1")echo "<option value=\"1\">Прод.пользователь</option>\n";
elseif($row["level"] === "2")echo "<option value=\"2\">Чаттер</option>\n";
elseif($row["level"] === "3")echo "<option value=\"3\">Тусовщик</option>\n";
elseif($row["level"] === "4")echo "<option value=\"4\">4-Vip</option>\n";
elseif($row["level"] === "5")echo "<option value=\"5\">Киллер</option>\n";
elseif($row["level"] === "6")echo "<option value=\"6\">Ст.Модер</option>\n";
elseif($row["level"] === "7")echo "<option value=\"7\">РђРґРјРёРЅ</option>\n";
if ($row["level"]!=0) echo "<option value=\"0\">Пользователь</option>\n";
if ($row["level"]!=1) echo "<option value=\"1\">Прод.пользователь</option>\n";
if ($row["level"]!=2) echo "<option value=\"2\">Чаттер</option>\n";
if ($row["level"]!=3) echo "<option value=\"3\">Тусовщик</option>\n";
if ($row["level"]!=4) echo "<option value=\"4\">4-Vip</option>\n";
if ($row["level"]!=5) echo "<option value=\"5\">Киллер</option>\n";
if ($row["level"]!=6) echo "<option value=\"6\">Ст.Модер</option>\n";
if ($row["level"]!=7) echo "<option value=\"7\">РђРґРјРёРЅ</option>\n";
echo "</select><br/>\n";
echo "<anchor title=\"go\">Сохранить<go href=\"apanel.php?go=upd&id=$id&ps=$ps\" method=\"post\">\n";
echo "<postfield name=\"upid\" value=\"$row[id]\"/>\n";
echo "<postfield name=\"upnick\" value=\"$(upnick$ref)\"/>\n";
echo "<postfield name=\"upass\" value=\"$(upass$ref)\"/>\n";
echo "<postfield name=\"posts\" value=\"$(posts$ref)\"/>\n";
echo "<postfield name=\"status\" value=\"$(status$ref)\"/>\n";
echo "<postfield name=\"inv\" value=\"$(inv$ref)\"/>\n";
echo "<postfield name=\"level\" value=\"$(level$ref)\"/>\n";
echo "</go></anchor><br/>\n";
echo "*********<br/>\n";
echo "<a href=\"apanel.php?id=$id&ps=$ps&ref=$ref\">Apanel</a>\n";
echo "</p>\n";
echo "</card>\n";
echo "</wml>\n";
mysql_close ($link);
exit;
}
if(@$go=="upd")
{
$upnick=trim($upnick);
if($upnick==""){
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=\"apanel.php?id=$id&ps=$ps&ref=$ref\"><timer value=\"15\"/>\n";
echo "<p align=\"center\">\n";
echo "error\n";
echo "</p>\n";
echo "</card>\n";
echo "</wml>\n";
mysql_close ($link);
exit;
}
$a = mysql_query("SELECT user,level FROM mafusers WHERE id ='".$upid."'");
$b = mysql_fetch_array ($a);
$prl = $b["level"];
$nick = $b["user"];
$latuser=strtolower($upnick);
$ruser = rus_to_k($upnick);
if($ruser==$upnick){
mysql_query ("Select id from mafusers where (latuser = '".$latuser."')and(user != '".$nick."')");
} else {
mysql_query ("select id from mafusers where (ruser = '".$ruser."')and(user != '".$nick."')");
}
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\">\n";
echo "<do type=\"prev\" label=\"Назад\"><prev/></do>\n";
echo "<p>\n";
echo "Пользователь с таким ником уже сушествует<br/>\n";
echo "</p>\n";
echo "</card>\n";
echo "</wml>\n";
mysql_close($link);
exit;
}
if ($ruser==$upnick) $ins_str = "Update mafusers set user='".$upnick."', pass='".$upass."', posts='".$posts."', status='".$status."', inv='".$inv."', level='".$level."', ruser = '', latuser = '".$latuser."' where id ='".$upid."'";
else $ins_str = "Update mafusers set user='".$upnick."', pass='".$upass."', posts='".$posts."', status='".$status."', inv='".$inv."', level='".$level."', ruser = '".$ruser."', latuser = '' where id ='".$upid."'";
if (mysql_query ($ins_str)) {
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=\"ok\" title=\"ok\" ontimer=\"apanel.php?id=$id&ps=$ps&ref=$ref\"><timer value=\"10\"/>\n";
echo "<p>\n";
echo "Профайл изменен\n";
echo "</p>\n";
echo "</card>\n";
echo "</wml>\n";
mysql_close($link);
exit;
} else {
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=\"ok\" title=\"ok\" ontimer=\"apanel.php?id=$id&ps=$ps&ref=$ref\"><timer value=\"10\"/>\n";
echo "<p>\n";
echo "Database error:<br/>\n";
echo " ".mysql_error()." ";
echo "</p>\n";
echo "</card>\n";
echo "</wml>\n";
mysql_close($link);
exit;
}
}
?>