<?
Error_Reporting(E_ALL & ~E_NOTICE); /////////////// игнорируем ошибки
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
list($msec,$sec)=explode(chr(32),microtime());
$HeadTime=$sec+$msec;
$rand=rand(10000,1000000);
require("conf.inc.php");
global $REMOTE_ADDR;
global $HTTP_USER_AGENT;
$pass=@mysql_escape_string($pass);
$link=mysql_connect ($DB_HOST, $DB_USER, $DB_PASS);
mysql_select_db($DB_NAME);
if(empty($id)) {
$find_user=mysql_query("Select * from users where cid='".$cid."' AND login='".$login."' and pass='".$pass."'") or die("Querry error");
} else {
$find_user=mysql_query("Select * from users where cid='".$cid."' AND id='".$id."' and pass='".$pass."'") or die("Querry error");
}
if(mysql_affected_rows()==0)
{
echo <<<END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="search" title="РџРѕРСвЂВВВРЎРѓР С”">
<p align="center">
Логин или пароль неверны, проверьте ваш ввод.
</p>
</card>
</wml>
END;
return 0;
}
else
{
$row=mysql_fetch_array($find_user);
$login=$row['login'];
$id=$row['id'];
$admin=$row['admin'];
$status=$row['status'];
$posts=$row['posts'];
if (($row["browser"]!==$HTTP_USER_AGENT) or ($row["ip"]!==$REMOTE_ADDR))
{
mysql_query("update users set browser='$HTTP_USER_AGENT', ip='$REMOTE_ADDR' where cid='".$cid."' AND id='$id';");
}
//Проверка, не забанен ли ip+browser:
mysql_query ("Select * from bannedib WHERE cid='".$cid."' AND (ip = '".$REMOTE_ADDR."')and(browser = '".$HTTP_USER_AGENT."')");
if(mysql_affected_rows()!=0)
{
echo <<<END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="error" title="Забанен">
<p align="center">
Вы забанены по связке ip+browser!
</p>
</card>
</wml>
END;
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 "<card id=\"setup\" title=\"Настройки чата\">\n";
echo "<p align=\"left\">\n";
if(empty($action)) {
?>
Кол-во сообщений:<br/>
<select name="num_msgs" title="Кол-во сообщений" value="<? if(!empty($row['num_msgs'])) print $row['num_msgs']; ?>">
<option value="5">5</option>
<option value="8">8</option>
<option value="10">10</option>
<option value="12">12</option>
<option value="15">15</option>
<option value="20">20</option>
</select><br/>
Время обновления:<br/>
<select name="time_update" title="Время обновления" value="<? if(!empty($row['time_update'])) print $row['time_update']; ?>">
<option value="150">15</option>
<option value="200">20</option>
<option value="300">30</option>
<option value="450">45</option>
<option value="500">50</option>
<option value="600">60</option>
</select><br/>
Система безопасности:<br/>
<select name="safe" title="Безопасность" value="<? if(!empty($row['safe'])) print $row['safe']; ?>">
<option value="0">выкл.</option>
<option value="1">вкл.</option>
</select><br/>
Транслит:<br/>
<select name="trans" title="Транслит" value="<? if(!empty($row['trans'])) print $row['trans']; ?>">
<option value="0">выкл.</option>
<option value="1">вкл.</option>
</select><br/>
Смайлы:<br/>
<select name="smile" title="Смайлы" value="<? if(!empty($row['smile'])) print $row['smile']; ?>">
<option value="0">выкл.</option>
<option value="1">вкл.</option>
</select><br/>
Размер шрифта:<br/>
<select name="fsize" value="<? if(!empty($row['fsize'])) print $row['fsize']; ?>">
<option value="small">Маленький</option>
<option value="medium">Нормальный</option>
<option value="big">Большой</option>
</select><br/>
<anchor>Изменить<go href="setup.php?id=<? print $id; ?>&pass=<? print $pass; ?>&cid=<? print $cid; ?>&ref=<? print $rand; ?>" method="post">
<postfield name="action" value="setup"/>
<postfield name="num_msgs" value="$(num_msgs)"/>
<postfield name="time_update" value="$(time_update)"/>
<postfield name="trans" value="$(trans)"/>
<postfield name="smile" value="$(smile)"/>
<postfield name="safe" value="$(safe)"/>
<postfield name="fsize" value="$(fsize)"/></go></anchor>
<?
}
else
{
if(empty($num_msgs)) $num_msgs = 5;
if(empty($time_update)) $time_update = 300;
if(empty($safe)) $safe = 0;
if(empty($trans)) $trans = 0;
if(empty($smile)) $smile = 0;
if(empty($fsize)) $fsize = small;
$query=@mysql_query("update users set num_msgs='".$num_msgs."', time_update='".$time_update."', trans='".$trans."', smile='".$smile."', safe='".$safe."', fsize='".$fsize."' where cid='".$cid."' and id='".$id."';");
if($query) print "<b>Настройки изменены!</b><br/>";
print "<a href=\"enter.php?id=$id&pass=$pass&cid=$cid&ref=$rand\">Прихожая</a>";
}
}
?>
</p></card></wml>
<?
mysql_close($link);
?>