<?php
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
print '<?xml version="1.0" encoding="utf-8"?>';
print '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"'.
' "http://www.wapforum.org/DTD/wml_1.1.xml">'.
'<wml><head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>';
include "./ini.php";
mysql_query ("select * from bannedib WHERE ci='$ci' AND (ip = '".getenv(REMOTE_ADDR)."')and(browser = '".getenv(HTTP_USER_AGENT)."')");
                        if(mysql_affected_rows()!=0){include "b.php";}

mysql_query ("select * from bannedib WHERE ci='$ci' AND (ip = '".getenv(REMOTE_ADDR)."')and(browser = '".getenv(HTTP_USER_AGENT)."')");
                        if(mysql_affected_rows()!=0){include "b.php";}
$login = autorize();
if($search) {
$query_users = @mysql_query("select * from `".$px.$utable."` where login='".$dblogin."' and ci= '$ci';");
$data = @mysql_fetch_array($query_users);
} else {
$query_users = @mysql_query("select * from `".$px.$utable."` where id='$dbid' and ci='$ci';");
$data = @mysql_fetch_array($query_users);
}
print '<card title="Statistic">'.
'<p>';
$query_users = @mysql_query("select * from `".$px.$utable."` where id='".$id."'  and ci='$ci';");
$q = @mysql_query("select * from `".$px.$utable."` where ci='$ci' and id='".$id."'  order by posts desc limit 10;");
$q1 = @mysql_query("select * from `".$px.$utable."` where sex='m' and ci='$ci';");
$q2 = @mysql_query("select * from `".$px.$utable."` where sex='zh' and ci='$ci';");
$q3 = @mysql_query("select * from `".$px.$utable."` where team='Green Team' and ci='$ci';");
$q4 = @mysql_query("select * from `".$px.$utable."` where team='Blue Team' and ci='$ci';");
$q5 = @mysql_query("select * from `".$px.$utable."` where team='Purple Team' and ci='$ci';");
$data = @mysql_fetch_array($query_users);
$login = autorize();
if(empty($id))
print "Sorry Not Loged in<br/>";
if($login) {
switch($mod) {
// Admins
case 'admins':
$q = @mysql_query("select `login`,`posts` from `".$px.$utable."` where admin>0 and moder>0 and ci='".$ci."';");
print "Adminstrator for chat:<br/>";
while($arr = @mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['login']." - ".$arr['posts']."<br/>"; }
break;
// Moders
case 'moders':
$q = @mysql_query("select `login`,`posts` from `".$px.$utable."` where moder=1 and admin=0 and ci='".$ci."';");
print "Moderators for chat:<br/>";
while($arr = @mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['login']." - ".$arr['posts']."<br/>"; }
break;
// Killers
case 'killers':
$q = @mysql_query("select `login`,`posts` from `".$px.$utable."` where moder=2 and admin=0 and ci='".$ci."';");
print "Killers for chat:<br/>";
while($arr = @mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['login']." - ".$arr['posts']."<br/>"; }
break;
// Hard Moder
case 'topmoder':
$q = @mysql_query("select `login`,`posts` from `".$px.$utable."` where moder=4 and admin=0 and ci='".$ci."';");
print "Head Moderators for chat:<br/>";
while($arr = @mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['login']." - ".$arr['posts']."<br/>"; }
break;
// Sen Hard Moser
case 'senior':
$q = @mysql_query("select `login`,`posts` from `".$px.$utable."` where moder=5 and admin=0 and ci='".$ci."';");
print "Senior Head Mods for chat:<br/>";
while($arr = @mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['login']." - ".$arr['posts']."<br/>"; }
break;
case 'shpion':
$q = @mysql_query("select `login`,`posts` from `".$px.$utable."` where moder=3 and admin=0 and ci='".$ci."';");
print "Spies for chat:<br/>";
while($arr = @mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['login']." - ".$arr['posts']."<br/>"; }
break;
// Top 10
case '10top':
$q = @mysql_query("select * from `".$px.$utable."`where ci='".$ci."' order by posts desc limit 10;");
print "Top 10 posters:<br/>";
while($arr = @mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['login']." - ".$arr['posts']."<br/>"; }
break;
// Green
case 'green':
$q = @mysql_query("select * from `".$px.$utable."`where ci='".$ci."' order by quiz desc limit 10;");
print "Top 10 Quiz Points:<br/>";
while($arr = @mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['login']." - ".$arr['team']."<br/>"; }

break;

// Quizs
case 'quiz':
$q = @mysql_query("select * from `".$px.$utable."`where ci='".$ci."' order by quiz desc limit 10;");
print "Top 10 Quiz Points:<br/>";
while($arr = @mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['login']." - ".$arr['quiz']."<br/>"; }

break;
// Players
case 'rap':
$q = @mysql_query("select * from `".$px.$utable."`where ci='".$ci."' order by wins desc limit 10;");
print "Top 10 Rappers:<br/>";
while($arr = @mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['login']." has won ".$arr['wins']." and loses ".$arr['lose']."<br/>"; }

break;
// Mod Log
case 'modlog':
$q = @mysql_query("select * from `".$px.$utable."`where ci='".$ci."' order by id desc limit 100;");
print "MOD LOG:<br/>";
while($arr = @mysql_fetch_array($q)){
 print "<b>New</b> ".$arr['login']." Registred ".$arr['ban']."<br/>"; }
break;

// Team
case 'team':
$q = @mysql_query("select * from `".$px.$team."`where ci='".$ci."' order by points desc limit 3;");
print "Top Teams:<br/>";
while($arr = @mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['team']." - ".$arr['points']."<br/>"; }
break;
// Cash
case 'cash':
$q = @mysql_query("select * from `".$px.$utable."`where ci='".$ci."' order by cash desc limit 10;");
print "Richest Users Online:<br/>";
while($arr = @mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['login']." - ".$arr['cash']."<br/>"; }
break;
// Photo
case 'photo':
$q = @mysql_query("select * from `".$px.$utable."`where ci='".$ci."' order by photo desc limit 3;");
print "Recent Photos:<br/>";
while($arr = @mysql_fetch_array($q)) {
++$i; print "<b>$i.</b>".$arr['login']."<br/>"; }
break;
// Main Page
default:
print "<small>Number of Males: ".@mysql_num_rows($q1)." <br/>";
print "Number of Females: ".@mysql_num_rows($q2)." <br/>";
$q = @mysql_query("select * from `".$px.$utable."`where ci='".$ci."' order by id desc limit 1;");
print "Newest Member: ";
while($arr = @mysql_fetch_array($q)){
$qdblogin = @mysql_query("select `id` from `".$px.$utable."` where `login`='$dblogin' and ci='$ci'");
$db = @mysql_fetch_array($qdblogin);
$dbid=$arr['id'];
 print "<b></b><a href=\"wap.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;room=$room&amp;dbid=$dbid\">".$arr['login']." - ".$arr['posts']."</a> <br/>"; }
print "---<br/>";
print "Number of Green: ".@mysql_num_rows($q3)." <br/>";
print "Number of Blue: ".@mysql_num_rows($q4)."<br/>";
print "Number of Purple: ".@mysql_num_rows($q5)." <br/>";
print "---<br/>Fun-ChaT Staff<br/>";
print '<img src="image/user.gif" alt="Fun-ChaT"/>';
print "<a href=\"statistic.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=admins\">Administrators</a><br/>";
print '<img src="image/user.gif" alt="Fun-ChaT"/>';
print "<a href=\"statistic.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=senior\">Senior Head Moderator</a><br/>";
print '<img src="image/user.gif" alt="Fun-ChaT"/>';
print "<a href=\"statistic.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=topmoder\">Head Moderator</a><br/>";
print '<img src="image/user.gif" alt="Fun-ChaT"/>';
print "<a href=\"statistic.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=shpion\">Spy</a><br/>";
print '<img src="image/user.gif" alt="Fun-ChaT"/>';
print "<a href=\"statistic.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=killers\">Killers</a><br/>";
print '<img src="image/user.gif" alt="Fun-ChaT"/>';
print "<a href=\"statistic.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=moders\">Moderator</a><br/>---<br/>Fun-ChaT Members<br/>";
print '<img src="image/star.gif" alt="Fun-ChaT"/>';
print "<a href=\"statistic.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=10top\">Top 10 Poster</a><br/>";
print '<img src="image/star.gif" alt="Fun-ChaT"/>';
print "<a href=\"statistic.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=quiz\">Top 10 Quiz Points</a><br/>";
print '<img src="image/star.gif" alt="Fun-ChaT"/>';
print "<a href=\"statistic.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=cash\">Richest Users Online</a><br/>";

print '<img src="image/star.gif" alt="Fun-ChaT"/>';
print "<a href=\"statistic.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=team\">Top Teams</a><br/>";
print "<img src=\"image/star.gif\" alt=\"Fun-ChaT\"/><a href=\"statistic.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=rap\">Rap History</a><br/>";
print "<img src=\"image/star.gif\" alt=\"Fun-ChaT\"/><a href=\"statistic.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=photo\">Photos</a><br/>";
print "<img src=\"image/star.gif\" alt=\"Fun-ChaT\"/><a href=\"statistic.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=modlog\">LOG</a>";
print "<br/>---<br/>";
print "</small>";
break;
}
if($mod)
print "<br/><a href=\"statistic.php?ci=$ci&amp;id=$id&amp;pass=$pass\">Statistics</a><br/>";
if($room)
print "<a href=\"room.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;room=$room\">Room</a><br/>";
else
print "<a href=\"enter.php?ci=$ci&amp;id=$id&amp;pass=$pass\">Hall</a><br/>";
        } else { print $lang['not_loged']; }
// End of script
@mysql_close();
print '</p>'.
'</card>'.
'</wml>';
ob_end_flush();
?>