<?php
/**
* 用戶列表
* kcj
* 2011/8/20
* */
include "../conn/conn.php";
$sql="select * from user";
$rst=mysql_query($sql);
$totalnum=mysql_num_rows($rst);
$pagesize=2;
$page=$_GET['page'];
if($page==''){
$page=1;
}
$pagecount=ceil($totalnum/$pagesize);
$bingage=($page-1)*$pagesize;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無標題文檔</title>
<meta name="Author" content="kcj" />
<meta name="Keywords" content="php,lampbrother" />
<link rel="stylesheet" type="text/css" href="style/lampcms.css">
<script src="javascript/common.js"></script>
</head>
<body>
<div id="main">
後台管理->用戶列表
<form method="post" action="" >
<div class="msg-box">
<ul class="viewmess">
<li class="dark-row">
<span class="list_width width_font">用戶名</span>
<span class="list_width width_font" style="width:200px">備注名</span>
<span class="list_width width_font">注冊時間</span>
<span class="list_width width_font">操 作</span>
</li>
<li class="light-row" style="padding-top:2px; padding-bottom:2px">
<?php
$sql="select * from user order by id asc limit $bingage,$pagesize";
$rst=mysql_query($sql);
while ($row=mysql_fetch_array($rst)){
?>
<span class="list_width"><?php echo $row['username'];?></span>
<span class="list_width" style="width:200px"><?php echo $row['rname'];?></span>
<span class="list_width"><?php echo $row['ctime'];?></span>
<span class="list_width" style="width:160px;">
【<a href="main.php?action=addUser&edit=mod&id=<{ $users[doc].id }>">修改</a>】
<?php if($row['id']!=1){?>
【<a onclick="return confirm('確定要刪除用戶<{ $users[doc].userName }>嗎?')" href="main.php?action=editUser&page=<{ $pageInfo.current_page }>&id=<{ $users[doc].id }>&edit=del">刪除</a>】
<?php }?>
</span>
<?
}
?>
</li>
<li class="dark-row">
<span class="col_width" style="margin-left:15px;width:240px;">
共<?php echo $totalnum;?>條; 共<?php echo $pagecount;?>頁; 每頁顯示<?php echo $pagesize;?>條
<a href="<?php echo $_SERVER['PHP_SELF']?>?page=1">首頁</a>
<?php
for ($i=1;$i<=$pagecount;$i++){
echo "<a href=".$_SERVER['PHP_SELF']."?page=$i".">【".$i."】</a>";
}
?>
<a href="<?php echo $_SERVER['PHP_SELF']."?page=".$pagecount;?>">尾頁</a>
</span>
</li>
</ul>
</div>
</form>
</div>
</body>
</html>
摘自 chaojie2009的專欄