<?

require("datafile/config.php");
require("datafile/style.php");
require("global.php");
require("header.php");
if (empty($page)) $page=1;
$user_list_file='datafile/userlist.php';
navi_bar('你现在正在<br>VIB论坛 <br>的用户列表程式中','用户列表','','no');
?>
<br>
<table width="600" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="<?=$bordercolor?>">
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="1" cellpadding="2">
        <tr align=center><td colspan=6 bgcolor=<?=$titlecolor?> background=images/style/catbg.gif>用户列表</td></tr>
        <tr bgcolor="<?=$subcolor?>">
          <td width="15%" align="center">头像</td>
          <td width="14%" align="center">用户名</td>
          <td width="20%" align="center">邮箱</td>
          <td width="17%" align="center">来自</td>
          <td width="17%" align="center">ＱＱ号码</td>
          <td width="17%" align="center">发表文章数目</td>
        </tr>
<?
if (file_exists($user_list_file)) {
	$user_array=explode("\n",readfromfile($user_list_file));
}else {
	$dh=opendir("$id_unique/");
	while ($userfile=readdir($dh)) {
		if (($userfile!=".") && ($userfile!="..") && ($userfile!="") && !strpos($userfile,".snd") && !strpos($userfile,".rec")) {
			$user_array[]=$userfile;
		}
	}
	closedir($dh);
	writetofile($user_list_file,implode("\n",$user_array)."\n");
}
$count=count($user_array);
if ($count%$userperpage==0) $maxpageno=floor($count/$userperpage);
else $maxpageno=floor($count/$userperpage)+1;
if ($page>$maxpageno) { $page=$maxpageno; $pagemax=$count-1; $pagemin=max(0,$count-$userperpage-1);}
	else { if ($page==1) {$pagemin=0; $pagemax=min($count-1,$userperpage-1); }
		else { $pagemin=min($count-1,$userperpage*($page-1)); $pagemax=min($count-1,$pagemin+$userperpage-1); }}
for ($counter=$pagemin; $counter<=$pagemax; $counter++) {
	if (!trim($user_array[$counter])) continue;
	$userfile=$id_unique."/".trim($user_array[$counter]);
	if (!file_exists($userfile)) continue;
	$user_info=explode("|",readfromfile($userfile));
	$usericon=get_user_portait($user_info[2]);
	echo '<tr bgcolor="#FFFFFF"> ';
	echo "<td ><a href='vibprofile.php?job=show&target=$user_info[0]'>$usericon</a></td>";
	echo "<td bgcolor=#EEEEEE><a href='vibprofile.php?job=show&target=$user_info[0]'><b>$user_info[0]</b></a></td>";
	if ($user_info[13]!=0) echo "<td><a href='sendmail.php?target=$user_info[0]'>$user_info[3]</a></td>";
	else echo "<td>用户保密</td>";
	echo "<td bgcolor=#EEEEEE>$user_info[8]</td>";
	echo "<td >$user_info[4]</td>";
	echo "<td bgcolor=#EEEEEE>$user_info[12]</td></tr>";
}
?>
        <tr> 
          <td bgcolor=<?=$subcolor?> align=center colspan=6><input type="button" value="论坛首页" onClick="location.href='viboard.php'" style="color: #000000; background-color: #f3f3f3; border-style: solid; border-width: 1" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'">
<input type="button" value="返回前页" onClick="javascript:history.back(1)" style="color: #000000; background-color: #f3f3f3; border-style: solid; border-width: 1" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'"></td>
        </tr>
      </table>
    </td>
  </tr>
<TABLE style=BORDER-COLLAPSE: collapse borderColor=#111111 cellSpacing=0 cellPadding=0 width=600 align=center border=0><TBODY><tr>
  <td background=images/style/bottombg.gif><P align=left><IMG height=18 src=images/style/bottomleft.gif width=2 border=0></P></td>
  <td background=images/style/bottombg.gif><P align=right><IMG height=18 src=images/style/bottomright.gif width=2 border=0></P></td>
</TBODY></tr>
</TABLE>
</table>
<TABLE width=600 align=center cellspacing=0 cellpadding=0>
  <TR> 
    <TD align=left width="600"><font face="verdana" bgcolor="#EEEEEE">
    可选择页:
    <?
echo "[ ";
$nextpage=$page+1;
$previouspage=$page-1;
if ($page>=2) echo "<a href=\"userlist.php?page=$previouspage\">上一页</a> ";
	else echo "上一页 ";

if ($page<=$maxpageno-1) echo "<a href=\"userlist.php?page=$nextpage\">下一页</a> ";
	else echo "下一页 ";
      
for ($i=1; $i<=$maxpageno; $i++) {
	if ($i!=$page) 
	echo " <a href=\"userlist.php?page=$i\">$i</a> ";
	if ($i==20) {echo "以及更多 "; break;}
}

echo "]"
?>
</font></TD>
</TR>
</TABLE>
<br>
<? require("footer.php");
exit;