<?php
#------------------------------------------------------#
#                 本程序为zchain.net改编               #
#              zChain留言簿2000多用户版v3.00           #
#------------------------------------------------------#
$perpage=20;

######################
## 以下部分不需修改 ##
######################
require "setup.php";
require "core/class_basic_record_file.php";
require "core/class_book_list.php";
require "core/class_message_list.php";

$cgiurl=$PHP_SELF;

##########
$oBooks=new CBookList;
$oBooks->open();
$size=$oBooks->getRecordCount();
$pages=ceil($size/$perpage);

print <<<EOT
<html>
<head>
<TITLE>用户列表</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css"><!--
a:link {  font-family: "宋体", "serif"; font-size: 9pt; color: #004080; text-decoration: none}
a:hover {  color: #004080; text-decoration: underline; background-color: #CCCC99}
a:visited {  text-decoration: none}
body {  font-family: "宋体", "serif"; font-size: 9pt}
td {  font-family: "宋体", "serif"; font-size: 9pt}
input {  font-size: 9pt}
table {  font-size: 9pt}
p {  font-size: 9pt} br {  font-size: 9pt} tr {  font-size: 9pt}
--></style>
</head>
<body background="$imgurl/bg.jpg">
<br><div align="center"><center>
<font color=#FF0000>>></font><a href="reg.php">免费申请</a><font color=#FF0000>>></font><a href=regedit.php>版主资料修改</a><font color=#FF0000>>></font><a href="admin.php">超级用户管理</a><font color=#FF0000>>></font>用户列表
<br>居民数:<font color=#FF0000>$size</font>
<table border=1 width="80%" bordercolorlight=#008000 cellspacing=0 cellpadding=0 bordercolordark=#FFFFFF>
</tr>
<tr>
<td background=$imgurl/tablebg.gif width="55%" align="center"><font color=ffffff>{$cginame}名称</font></td>
<td background=$imgurl/tablebg.gif width="10%" align="center"><font color=ffffff>留言数</font></td>
<td background=$imgurl/tablebg.gif width="15%" align="center"><font color=ffffff>版主</font></td>
<td background=$imgurl/tablebg.gif width="20%" align="center"><font color=ffffff>申请时间</font></td>
</tr>
EOT;

$oMsgs=new CMessageList;

if ($page == "") {$page=$pages;}
$firstitem=($page-1)*$perpage;
$lastitem=$firstitem+$perpage;
if($lastitem>$size){$lastitem=$size;}
$oBooks->moveTo($firstitem);
for($i=$firstitem; $i<$lastitem; $i++) {
 $oMsgs->open($oBooks->name);
 $lys=$oMsgs->getRecordCount();

 print <<<EOT
<tr><td><a href=$gburl?id=$oBooks->name target=_blank>$oBooks->title</a><br>$oBooks->desc</td>
<td align='center'><font color=#FF0000>$lys</font></td>
<td align='center'><a href='mailto:$oBooks->email'>$oBooks->name</a></td>
<td align='center'>$oBooks->regtime</td></tr>
EOT;

 $oBooks->moveNext();
}

print "
<tr><td align='center' width='100%' colspan=5 bgcolor='#FFF5E1'>$copyright</td></tr>
<tr><td colspan=5 align=center>";

for ($i=$pages; $i>=1; $i--){
 if ($page != $i) {print "<a href=$cgiurl?page=$i>";};
 print "[$i]";
 if ($page != $i) {print "</a>";};
}
print "</td></tr></table></center></div></body></html>";
exit;
?>