<?
require"ygl.php";
if(!isset($ses_user_id)||!isset($ses_user_psd)){errorview("对不起，你没有登陆！！");exit;}
$user_login_id=$ses_user_id;
$user_login_psd=$ses_user_psd;
read_user_zl($user_login_id);
if($userpass1!=$ses_user_psd){errorview("非法登陆！");exit;}
############
if($toppage==""||$toppage=="top")toplist();

############
function toplist()
{
global $username,$useroicq,$usermail,$userdate,$userfrom;
$ynhead2="1";
$title="用户排行榜";
include"header.php";
print<<<EOT
<table width="750" border="1" cellspacing="0" cellpadding="2" align="center" bordercolorlight="#B5E1F7" bordercolordark="#FFFFFF">
 <tr align="center">
  <td width="97"><b><font color="#000099">姓　名</font></b></td>
  <td width="100"><b><font color="#000099">省　份</font></b></td>
  <td width="102"><b><font color="#000099">OICQ</font></b></td>
  <td width="254"><b><font color="#000099">E-mail</font></b></td>
  <td width="105"><b><font color="#000099">注 册 时 间</font></b></td>
  <td width="78"><b><font color="#000099">登 陆 次 数</font></b></td>
 </tr>
EOT;
$lines = file("user/list");
$size = count($lines);
if($size=="0")print"没有用户！！";
else
{
for($i=0; $i<$size; $i++) {
 $linea=$lines[$i];
 $linea=ereg_replace("\n","", $linea);
 if ($linea != "") {
 $lines1a=file("user/list");
 while (list($tmpkey, $line1a) = each($lines1a))
  {
  $line1=ereg_replace("\n","", $line1);
  list($topuser)=split("\t",$linea);
   }
$liness = file("count/$topuser.php");
while (list($tmpkey,$line) = each($liness))
   {
   $line=ereg_replace("\n","",$line);
   list($e_num,$e_ip,$e_time)=split("\t",$line);
   }
$rank_array[$topuser]=$e_num;
}
}
arsort($rank_array);
reset($rank_array);
for ($counter=1; $counter<=10; $counter++) {
$key=key($rank_array);
read_user_zl($key);
if($useroicq=="")$useroicq="无";
if($usermail=="")$usermail="无";
print<<<EOT
<tr align=center>
  <td width="97">$username</td>
  <td width="100">$userfrom</td>
  <td width="102">$useroicq</td>
  <td width="254">$usermail</td>
  <td width="105" align=left>$userdate</td>
  <td width="78">$rank_array[$key]</td>
 </tr>
EOT;

if (!(next($rank_array))) break;
}
}
print"</table>";
include"footer.php";
}
?>