<?
/*
	[SueamCMS] (C)2009-2010 ZMRNet Studio
	adm_list.php by 2009-10-11 zmrnet
*/
require_once(dirname(__FILE__).'/include/manage.php');

$page_size = 30;
$this_title = '所有管理员';

$page = (int) trim($_GET['page']);
if(!$page) $page=1;

// $page_count
$rs = $_VDB['adm'];
$row_num = count($rs);

if($row_num ){
	if($row_num<$page_size){$page_count=1;}
	if($row_num%$page_size){
		$page_count = (int)($row_num /$page_size)+1;
	}else{
		$page_count = $row_num /$page_size;
	}
}else{
	$page_count = 0;
}

$page_ended = $page + 5;
$page_start = $page - 5;
if($page_ended>$page_count){
	$page_ended=$page_count;
	$page_start = $page_ended - 10;
}
if($page_start<0) $page_start=0;

$page_str = '';
if($page==1){
	$page_str .= '首页 上一页 ';
}else{
	$page_str .= '<a href="?listid='.$ListID.'&page=1">首页</a> ';
	$page_str .= '<a href="?listid='.$ListID.'&page='.($page-1).'">上一页</a> ';
}
for($i=$page_start;$i<$page_ended;$i++){
	$page_str .= '<a href="?listid='.$ListID.'&page='.($i+1).'">'.($i+1).'</a> ';
}
if($page_count&&($page!=$page_count)){
	$page_str .= '<a href="?listid='.$ListID.'&page='.($page+1).'">下一页</a> ';
	$page_str .= '<a href="?listid='.$ListID.'&page='.$page_count.'">尾页</a>';
}else{
	$page_str .= '下一页 末页';
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><? echo $sys_title; ?></title>
<link href="images/sueam.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div style="margin:20px;">
	<div style="margin:10px;font-size:14px;color:green"><b><? echo $this_title;?></b></div>
	<div class="sec_menu" style="padding:10px;">
	<div style="text-align:left;">
		<font color="blue">操作</font>&nbsp;&nbsp;
		<font color="red">管理员</font>&nbsp;&nbsp;(管理员信息)
	</div>
<?
$rs = array_chunk($rs,$page_size,true);
if($rs = $rs[$page-1]){
	foreach($rs as $key => $row){
		$adm_name	= $key;
		$adm_ip		= $row['ip'];
		$adm_num	= $row['num'];
		$adm_time	= $row['time'];
		$adm_lock	= $row['lock'];
?>
	<div style="text-align:left;">
<? if($Locked){ ?>
		<a href="adm_act.php?act=unlock&admin=<? echo $adm_name; ?>">解锁</a>&nbsp;&nbsp;
<? }else{ ?>
		<a href="adm_act.php?act=lock&admin=<? echo $adm_name; ?>">锁定</a>&nbsp;&nbsp;
<? } ?>	
		<font color="red"><? echo $adm_name; ?></font>&nbsp;&nbsp;
		(
			登录<b><? echo $adm_num; ?></b>次,
			最后登录时间:<? echo $adm_time; ?>,
			登录IP:<? echo $adm_ip; ?>
		)
	</div>
<?
	}
}
unset($rs);
unset($_VDB);
unset($vdb);
?>
	</div>
</div>
<div style="margin:20px;">
	<div class="sec_menu"><? echo $page_str; ?></div>
</div>
</body>
</html>