Просмотр файла chat_servis/stats.php

Размер файла: 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">
				&#x41B;&#x43E;&#x433;&#x438;&#x43D; &#x438;&#x43B;&#x438; &#x43F;&#x430;&#x440;&#x43E;&#x43B;&#x44C; &#x43D;&#x435;&#x432;&#x435;&#x440;&#x43D;&#x44B;, &#x43F;&#x440;&#x43E;&#x432;&#x435;&#x440;&#x44C;&#x442;&#x435; &#x432;&#x430;&#x448; &#x432;&#x432;&#x43E;&#x434;.
			</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">
								&#x412;&#x44B; &#x437;&#x430;&#x431;&#x430;&#x43D;&#x435;&#x43D;&#x44B; &#x43F;&#x43E; &#x441;&#x432;&#x44F;&#x437;&#x43A;&#x435; 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=\"&#x421;&#x442;&#x430;&#x442;&#x438;&#x441;&#x442;&#x438;&#x43A;&#x430; &#x447;&#x430;&#x442;&#x430;\">\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 "&#x412;&#x441;&#x435;&#x43C;&#x438; &#x43B;&#x44E;&#x431;&#x438;&#x43C;&#x44B;&#x435; &#x430;&#x434;&#x43C;&#x438;&#x43D;&#x44B;:)<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 "&#x41C;&#x43E;&#x434;&#x435;&#x440;&#x44B; &#x447;&#x430;&#x442;&#x430;:<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 "&#x421;&#x443;&#x43F;&#x435;&#x440; &#x437;&#x43B;&#x43E;&#x431;&#x43D;&#x44B;&#x435; &#x43C;&#x43E;&#x434;&#x435;&#x440;&#x44B; &#x447;&#x430;&#x442;&#x430;:<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. &#x447;&#x430;&#x442;&#x430;:<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 "&#x415;&#x449;&#x451; &#x43D;&#x435; &#x43D;&#x430;&#x43A;&#x430;&#x437;&#x430;&#x43D;&#x43D;&#x44B;&#x435; &#x444;&#x43B;&#x443;&#x434;&#x435;&#x440;&#x44B; &#x447;&#x430;&#x442;&#x430;:<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 "&#x412;&#x441;&#x435;&#x433;&#x43E; &#x43F;&#x43E;&#x43B;&#x44C;&#x437;&#x43E;&#x432;&#x430;&#x442;&#x435;&#x43B;&#x435;&#x439;: $allu<br/>";
			echo "&#x410;&#x43A;&#x442;&#x438;&#x432;&#x43D;&#x44B;&#x445; &#x43F;&#x43E;&#x43B;&#x44C;&#x437;&#x43E;&#x432;&#x430;&#x442;&#x435;&#x43B;&#x435;&#x439;: $allactu<br/>";
			echo "&#x427;&#x438;&#x441;&#x43B;&#x43E; &#x43F;&#x430;&#x440;&#x43D;&#x435;&#x439;: $cmans<br/>";
			echo "&#x427;&#x438;&#x441;&#x43B;&#x43E; &#x434;&#x435;&#x432;&#x443;&#x448;&#x435;&#x43A;: $cwomans<br/><br/>";
			echo "<a href=\"stats.php?id=$id&amp;pass=$pass&amp;mod=10best&amp;cid=$cid&amp;ref=$rand\">10 &#x431;&#x43E;&#x43B;&#x442;&#x43B;&#x438;&#x432;&#x44B;&#x445;!</a><br/>";
			echo "<a href=\"stats.php?id=$id&amp;pass=$pass&amp;mod=adminz&amp;cid=$cid&amp;ref=$rand\">&#x410;&#x434;&#x43C;&#x438;&#x43D;&#x44B; &#x447;&#x430;&#x442;&#x430;</a><br/>";
			echo "<a href=\"stats.php?id=$id&amp;pass=$pass&amp;mod=smoderz&amp;cid=$cid&amp;ref=$rand\">&#x421;&#x443;&#x43F;&#x435;&#x440; &#x43C;&#x43E;&#x434;&#x435;&#x440;&#x44B; &#x447;&#x430;&#x442;&#x430;</a><br/>";
			echo "<a href=\"stats.php?id=$id&amp;pass=$pass&amp;mod=moderz&amp;cid=$cid&amp;ref=$rand\">&#x41C;&#x43E;&#x434;&#x435;&#x440;&#x44B; &#x447;&#x430;&#x442;&#x430;</a><br/>";
			echo "<a href=\"stats.php?id=$id&amp;pass=$pass&amp;mod=vip&amp;cid=$cid&amp;ref=$rand\">V.I.P. &#x447;&#x430;&#x442;&#x430;</a><br/>";
			echo "<br/><a href=\"enter.php?id=$id&amp;pass=$pass&amp;cid=$cid&amp;ref=$rand\">&#x41F;&#x440;&#x438;&#x445;&#x43E;&#x436;&#x430;&#x44F;</a><br/>";
break;
}
if($mod) {
			echo "<br/><a href=\"stats.php?id=$id&amp;pass=$pass&amp;cid=$cid&amp;ref=$rand\">&#x421;&#x442;&#x430;&#x442;&#x438;&#x441;&#x442;&#x438;&#x43A;&#x430;</a><br/>";
			echo "<a href=\"enter.php?id=$id&amp;pass=$pass&amp;cid=$cid&amp;ref=$rand\">&#x41F;&#x440;&#x438;&#x445;&#x43E;&#x436;&#x430;&#x44F;</a><br/>";
}
echo $fsize2;
}
?>
</p>
</card>
</wml>
<?
mysql_close($link);
?>