File size: 7.35Kb
<?
Error_Reporting(E_ALL & ~E_NOTICE); /////////////// игнорируем ошибки
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
$rand=rand(10000,1000000);
require("conf.inc.php");
global $REMOTE_ADDR;
global $HTTP_USER_AGENT;
$id=@mysql_escape_string($id);
$pass=@mysql_escape_string($pass);
$login=@mysql_escape_string($login);
$link=mysql_pconnect ($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'];
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 title=\"Статистика чата\">\n";
echo "<p align=\"left\">\n";
if($row['fsize'] == "small") { $fsize1 = "<small>"; $fsize2 = "</small>"; }
elseif($row['fsize'] == "big") { $fsize1 = "<big>"; $fsize2 = "</big>"; }
else { $fsize1 = ""; $fsize2 = ""; }
echo $fsize1;
switch($mod) {
//
case 'adminz':
$q=mysql_query("select login,posts from users where cid='".$cid."' AND admin='1' order by posts desc;");
print "Всеми любимые админы:)<br/>";
while($arr=mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['login']." - ".$arr['posts']."<br/>"; }
break;
//
case 'moderz':
$q = mysql_query("select login,posts from users where cid='".$cid."' AND moder='1' order by posts desc;");
print "Модеры чата:<br/>";
while($arr=mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['login']." - ".$arr['posts']."<br/>"; }
break;
//
case 'smoderz':
$q=@mysql_query("select login,posts from users where cid='".$cid."' AND smoder='1' order by posts desc;");
print "Супер злобные модеры чата:<br/>";
while($arr=@mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['login']." - ".$arr['posts']."<br/>"; }
break;
//
case 'vip':
$q=@mysql_query("select login,posts from users where cid='".$cid."' AND vip='1' order by posts desc;");
print "V.I.P. чата:<br/>";
while($arr=@mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['login']." - ".$arr['posts']."<br/>"; }
break;
//
case '10best':
$q=@mysql_query("select login,posts from users where cid='".$cid."' order by posts desc limit 10;");
print "Ещё не наказанные флудеры чата:<br/>";
while($arr=@mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['login']." - ".$arr['posts']."<br/>"; }
break;
//
default:
//stats
$all=mysql_query("select id from users where cid='".$cid."' AND 1");
$allu=mysql_affected_rows()+0;
$allact=mysql_query("select id from users where cid='".$cid."' AND posts>1");
$allactu=mysql_affected_rows()+0;
$mans=mysql_query("select id from users where cid='".$cid."' AND sex='m'");
$cmans=mysql_affected_rows()+0;
$womans=mysql_query("select id from users where cid='".$cid."' AND sex='zh'");
$cwomans=mysql_affected_rows()+0;
echo "Всего пользователей: $allu<br/>";
echo "Активных пользователей: $allactu<br/>";
echo "Число парней: $cmans<br/>";
echo "Число девушек: $cwomans<br/><br/>";
echo "<a href=\"stats.php?id=$id&pass=$pass&mod=10best&cid=$cid&ref=$rand\">10 болтливых!</a><br/>";
echo "<a href=\"stats.php?id=$id&pass=$pass&mod=adminz&cid=$cid&ref=$rand\">Админы чата</a><br/>";
echo "<a href=\"stats.php?id=$id&pass=$pass&mod=smoderz&cid=$cid&ref=$rand\">Супер модеры чата</a><br/>";
echo "<a href=\"stats.php?id=$id&pass=$pass&mod=moderz&cid=$cid&ref=$rand\">Модеры чата</a><br/>";
echo "<a href=\"stats.php?id=$id&pass=$pass&mod=vip&cid=$cid&ref=$rand\">V.I.P. чата</a><br/>";
echo "<br/><a href=\"enter.php?id=$id&pass=$pass&cid=$cid&ref=$rand\">Прихожая</a><br/>";
break;
}
if($mod) {
echo "<br/><a href=\"stats.php?id=$id&pass=$pass&cid=$cid&ref=$rand\">Статистика</a><br/>";
echo "<a href=\"enter.php?id=$id&pass=$pass&cid=$cid&ref=$rand\">Прихожая</a><br/>";
}
echo $fsize2;
}
?>
</p>
</card>
</wml>
<?
mysql_close($link);
?>