Размер файла: 7.28Kb
<?
include 'db.php';
$parol="LEXXXA";
$index = "guwap.org";
/*Переколировка русских символов*/
function unicode ($s) { if ( (ord($s)>=192) & (ord($s)<=255) ) $hexvalue=dechex(ord($s)+848); if ($s=="Ё") $hexvalue="401"; if ($s=="ё") $hexvalue="451"; return("�".$hexvalue.";");}
function utf_encode ($s) { return(preg_replace("/[А-яЁё]/e","unicode('\\0')",$s));}
header("Content-type:text/vnd.wap.wml;charset=utf-8");
print '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">';
print '<wml><head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<card id="main" title="'.$index.'">
<p align="left">';
if ($password==$parol)
{
if (!$link = mysql_connect($DB_HOST, $DB_USER, $DB_PASS))
{
echo utf_encode('<br/>Не могу соединиться с сервером базы данных<br/></card></wml>');
exit();
}
if (!mysql_select_db($DB_NAME, $link))
{
echo utf_encode('<br/>Не могу выбрать базу данных<br/></p></card></wml>');
exit();
}
if ($kom=="see")
{
$ath = mysql_query("select * from users;");
if($ath)
{
while($users = mysql_fetch_array($ath))
{
echo utf_encode("<small>ID: <a href=\"admin.php?kom=podr&password=$parol&id=").$users['id'].
utf_encode("\">").$users['id'].utf_encode("</a> Голосов: ").$users['counter'].
utf_encode(" Переходов: ").$users['outcounter'].
utf_encode("<a href=\"admin.php?kom=edit&password=$parol&id=").$users['id'].utf_encode("\"> edit</a>|<a href=\"admin.php?kom=del&password=$parol&id=").$users['id'].utf_encode("\"> del</a></small><br/>")
;
}
echo utf_encode('<small><anchor>Назад<prev/></anchor></small>');
}
else
{
echo 'Error: '.mysql_error().'<br/>';
}
}
elseif ($kom=="podr")
{
$arr = mysql_query("SELECT * FROM `users` where id='$id';");
while ($data = @mysql_fetch_array($arr))
{
$id = trim($data['id']);
$title = trim($data['title']);
$link = trim($data['link']);
$pass = trim($data['pass']);
$email = trim($data['email']);
$about = trim($data['about']);
$ltime = trim($data['ltime']);
$counter = trim($data['counter']);
$category = trim($data['category']);
$outcounter = trim($data['outcounter']);
$allushlo = trim($data['allushlo']);
}
print '<small>';
print utf_encode('ID: '); print "$id <br/>";
print utf_encode('Название: '); print "$title <br/>";
print utf_encode('Ссылка: '); print "$link <br/>";
print utf_encode('Пароль: '); print "$pass <br/>";
print utf_encode('E-mail: '); print "$email <br/>";
print utf_encode('Описание: '); print "$about <br/>";
print utf_encode('Голосов: '); print "$counter <br/>";
print utf_encode('Категория: '); print "$category <br/>";
print utf_encode('Переходов: '); print "$outcounter <br/>";
print utf_encode('Переходов всего: '); print "$allushlo<br/>";
print utf_encode("<a href=\"admin.php?password=$parol\">Админка</a></small>");
}
elseif ($kom=="del")
{
if(mysql_query("delete from users where id='$id' limit 1;"))
{
print utf_encode("Участник удалён
<a href=\"admin.php?password=$parol\">Админка</a>");
}
else
{
print utf_encode('Невозможно удалить');
}
}
elseif($kom=="edit"){
$arr = @mysql_query("select `title`,`link`,`pass`,`email`,`about`,`counter`,`category`,`outcounter`,`allushlo` from `users` where id=$id");
while ($data = @mysql_fetch_array($arr))
{
$title = trim($data['title']);
$link = trim($data['link']);
$pas = trim($data['pass']);
$email = trim($data['email']);
$about = trim($data['about']);
$counter = trim($data['counter']);
$category = trim($data['category']);
$outcounter = trim($data['outcounter']);
$allushlo = trim($data['allushlo']);
}
print utf_encode("<small>Введите новые данные для ID: $id!</small><br/><br/>
<small>Название:</small><br/>");
print "<input type=\"text\" name=\"ntitle\" maxlength=\"50\" value=\"$title\"/><br/>";
print utf_encode("<small>Ссылка:</small><br/>");
print "<input type=\"text\" name=\"nlink\" maxlength=\"70\" value=\"$link\"/><br/>";
print utf_encode("<small>Пароль:</small><br/>");
print "<input type=\"text\" name=\"npass\" maxlength=\"50\" value=\"$pas\"/><br/>";
print utf_encode("<small>E-mail:</small><br/>");
print "<input type=\"text\" name=\"nemail\" maxlength=\"50\" value=\"$email\"/><br/>";
print utf_encode("<small>Описание:</small><br/>");
print "<input type=\"text\" name=\"nabout\" maxlength=\"200\" value=\"$about\"/><br/>";
print utf_encode("<small>Голосов:</small><br/>");
print "<input type=\"text\" name=\"ncounter\" maxlength=\"11\" value=\"$counter\"/><br/>";
print utf_encode("<small>Категория:</small><br/>");
print "<select name=\"ncategory\" value=\"$category\">
<option value=\"1\">Для мобил</option>
<option value=\"2\">Загрузки</option>
<option value=\"3\">Рротика</option>
<option value=\"4\">Халява</option>
<option value=\"5\">Р азное</option>
</select><br/>";
print utf_encode("<small>Переходов:</small><br/>");
print "<input type=\"text\" name=\"noutcounter\" maxlength=\"11\" value=\"$outcounter\"/><br/>";
print utf_encode("<small>Всего переходов:</small><br/>");
print "<input type=\"text\" name=\"nallushlo\" maxlength=\"11\" value=\"$allushlo\"/><br/>";
print utf_encode("<anchor title=\"go\">Изменить<go href=\"admin.php\" method=\"post\">");
print "<postfield name=\"kom\" value=\"editok\"/>
<postfield name=\"id\" value=\"$id\"/>
<postfield name=\"pass\" value=\"$pass\"/>
<postfield name=\"ntitle\" value=\"$(ntitle)\"/>
<postfield name=\"nlink\" value=\"$(nlink)\"/>
<postfield name=\"npass\" value=\"$(npass)\"/>
<postfield name=\"nemail\" value=\"$(nemail)\"/>
<postfield name=\"nabout\" value=\"$(nabout)\"/>
<postfield name=\"ncounter\" value=\"$(ncounter)\"/>
<postfield name=\"ncategory\" value=\"$(ncategory)\"/>
<postfield name=\"noutcounter\" value=\"$(noutcounter)\"/>
<postfield name=\"nallushlo\" value=\"$(nallushlo)\"/>
<postfield name=\"password\" value=\"$(parol)\"/>
</go></anchor><br/>";
print $index.'</p></card></wml>';
exit; }
elseif ($kom=="editok")
{
if(@mysql_query("update `users` set title='$ntitle',link='$nlink',pass='$npass',email='$nemail',about='$nabout',counter='$ncounter',category='$ncategory',outcounter='$noutcounter',allushlo='$nallushlo' where id='$id';")){
print utf_encode("профиль изменен!<br/>
<a href=\"admin.php?password=$parol\">Админка</a><br/>
<a href=\"http://$index\">$index</a><br/><br/>
</p></card></wml>");
exit;}
else { print utf_encode('Невозможно изменить');
}
}
else {
print utf_encode('
<anchor>Админка<go href="admin.php" method="post">
<postfield name="password" value="$(parol)"/>
<postfield name="kom" value="see"/>
</go>
</anchor>
<br/>');
print utf_encode("<a href=\"index.php\">Выйти</a>");
}
mysql_close();}
else
{
print utf_encode('Пароль:<input name="parol" type="text" maxlength="50"/><br/>
<anchor>[войти]<go href="admin.php" method="post">
<postfield name="password" value="$(parol)"/>
</go>
</anchor>
');
}
print '<br/>***<br/><a href="http://'.$index.'">На главную</a>
</p></card></wml>';
?>