<?
php
require_once
(
'
../Connections/lr.php
'
);
?>
<? php
// 设定每一页显示的记录数
$pagesize = 10 ;
// 取得记录总数$rs,计算总页数用
mysql_select_db ( $database_lr , $lr );
$rs = mysql_query ( " selectcount(*)fromadmin " );
$myrow = mysql_fetch_array ( $rs );
$numrows = $myrow [ 0 ];
// 计算总页数
$pages = intval ( $numrows / $pagesize );
if ( $numrows % $pagesize )
$pages ++ ;
// 设置页数
if ( isset ( $_GET [ ' page ' ])){
$page = intval ( $_GET [ ' page ' ]);
}
else {
// 设置为第一页
$page = 1 ;
}
// 计算记录偏移量
$offset = $pagesize * ( $page - 1 );
// 读取指定记录数
$rs = mysql_query ( " select*fromadminorderbyidlimit$offset,$pagesize " );
if ( $myrow = mysql_fetch_array ( $rs ))
{
$i = 0 ;
// 如果$url使用默认,即空值,则赋值为本页URL:
if ( ! $url ){ $url = $_SERVER [ " REQUEST_URI " ];}
// URL分析:
$parse_url = parse_url ( $url );
$url_query = $parse_url [ " query " ]; // 单独取出URL的查询字串
if ( $url_query ){
// 因为URL中可能包含了页码信息,我们要把它去掉,以便加入新的页码信息。
//这里用到了正则表达式,请参考“PHP中的正规表达式”(http://www.pconline.com.cn/pcedu/empolder/wz/php/10111/15058.html)
$url_query = ereg_replace ( " (^|&)page=$page " , "" , $url_query );
// 将处理后的URL的查询字串替换原来的URL的查询字串:
$url = str_replace ( $parse_url [ " query " ] , $url_query , $url );
// 在URL后加page查询信息,但待赋值:
if ( $url_query ) $url .= " &page " ; else $url .= " page " ;
} else {
$url .= " ?page " ;
}
?>
< tableborder = " 0 " width = " 80% " >
< tr >
< Tdbgcolor = " #E0E0E0 " > ID </ Td >
< tdwidth = " 40% " bgcolor = " #E0E0E0 " > 帐号 </ td >
< tdwidth = " 30% " bgcolor = " #E0E0E0 " > 密码 </ td >
< tdbgcolor = " #E0E0E0 " > 操作 </ td >
</ tr >
<? php
do {
$i ++ ;
?>
< tr >
< tdbgcolor = " #eeeeee " ><? PHP echo $myrow [ " id " ] ?></ td >
< tdwidth = " 40% " bgcolor = " #eeeeee " ><? PHP echo $myrow [ " user " ] ?></ td >
< tdwidth = " 30% " bgcolor = " #eeeeee " ><? PHP echo $myrow [ " password " ] ?></ td >
< Tdbgcolor = " #E0E0E0 " >< ahref = " admin_modify_user.php?id=<?phpecho$myrow[ " id " ]?> " > 修改密码 </ a ></ Td >
</ tr >
<? php
}
while ( $myrow = mysql_fetch_array ( $rs ));
echo " </table> " ;
}
echo " <divalign='center'>共有 " . $pages . " 页( " . $page . " / " . $pages . " ) " ;
// for($i=1;$i<$page;$i++)
//echo"<ahref='?page=".$i."'>[".$i."]</a>";
//echo"[".$page."]";
//for($i=$page+1;$i<=$pages;$i++)
//echo"<ahref='?page=".$i."'>[".$i."]</a>";
$first = 1 ;
$prev = $page - 1 ;
$next = $page + 1 ;
$last = $pages ;
if ($page > 1)
<? php
// 设定每一页显示的记录数
$pagesize = 10 ;
// 取得记录总数$rs,计算总页数用
mysql_select_db ( $database_lr , $lr );
$rs = mysql_query ( " selectcount(*)fromadmin " );
$myrow = mysql_fetch_array ( $rs );
$numrows = $myrow [ 0 ];
// 计算总页数
$pages = intval ( $numrows / $pagesize );
if ( $numrows % $pagesize )
$pages ++ ;
// 设置页数
if ( isset ( $_GET [ ' page ' ])){
$page = intval ( $_GET [ ' page ' ]);
}
else {
// 设置为第一页
$page = 1 ;
}
// 计算记录偏移量
$offset = $pagesize * ( $page - 1 );
// 读取指定记录数
$rs = mysql_query ( " select*fromadminorderbyidlimit$offset,$pagesize " );
if ( $myrow = mysql_fetch_array ( $rs ))
{
$i = 0 ;
// 如果$url使用默认,即空值,则赋值为本页URL:
if ( ! $url ){ $url = $_SERVER [ " REQUEST_URI " ];}
// URL分析:
$parse_url = parse_url ( $url );
$url_query = $parse_url [ " query " ]; // 单独取出URL的查询字串
if ( $url_query ){
// 因为URL中可能包含了页码信息,我们要把它去掉,以便加入新的页码信息。
//这里用到了正则表达式,请参考“PHP中的正规表达式”(http://www.pconline.com.cn/pcedu/empolder/wz/php/10111/15058.html)
$url_query = ereg_replace ( " (^|&)page=$page " , "" , $url_query );
// 将处理后的URL的查询字串替换原来的URL的查询字串:
$url = str_replace ( $parse_url [ " query " ] , $url_query , $url );
// 在URL后加page查询信息,但待赋值:
if ( $url_query ) $url .= " &page " ; else $url .= " page " ;
} else {
$url .= " ?page " ;
}
?>
< tableborder = " 0 " width = " 80% " >
< tr >
< Tdbgcolor = " #E0E0E0 " > ID </ Td >
< tdwidth = " 40% " bgcolor = " #E0E0E0 " > 帐号 </ td >
< tdwidth = " 30% " bgcolor = " #E0E0E0 " > 密码 </ td >
< tdbgcolor = " #E0E0E0 " > 操作 </ td >
</ tr >
<? php
do {
$i ++ ;
?>
< tr >
< tdbgcolor = " #eeeeee " ><? PHP echo $myrow [ " id " ] ?></ td >
< tdwidth = " 40% " bgcolor = " #eeeeee " ><? PHP echo $myrow [ " user " ] ?></ td >
< tdwidth = " 30% " bgcolor = " #eeeeee " ><? PHP echo $myrow [ " password " ] ?></ td >
< Tdbgcolor = " #E0E0E0 " >< ahref = " admin_modify_user.php?id=<?phpecho$myrow[ " id " ]?> " > 修改密码 </ a ></ Td >
</ tr >
<? php
}
while ( $myrow = mysql_fetch_array ( $rs ));
echo " </table> " ;
}
echo " <divalign='center'>共有 " . $pages . " 页( " . $page . " / " . $pages . " ) " ;
// for($i=1;$i<$page;$i++)
//echo"<ahref='?page=".$i."'>[".$i."]</a>";
//echo"[".$page."]";
//for($i=$page+1;$i<=$pages;$i++)
//echo"<ahref='?page=".$i."'>[".$i."]</a>";
$first = 1 ;
$prev = $page - 1 ;
$next = $page + 1 ;
$last = $pages ;
if ($page > 1)
{
echo "<a href='",$url,"=".$first."'>首页</a> ";
echo "<a href='",$url,"=".$prev."'>上一页</a> ";
}
if ($page < $pages)
{
echo "<a href='",$url,"=".$next."'>下一页</a> ";
echo "<a href='",$url,"=".$last."'>尾页</a> ";
}
echo " <selectname=changeonchange='window.location="$url="+this.value'> " ;
for ( $i = 1 ; $i <= $pages ; $i ++ ){
if ( $i == $page ) echo " <optionvalue='$i'selected>$i/$pages</option> " ;
else echo " <optionvalue='$i'>$i/$pages</option> " ;
}
echo " </select> " ;
echo " </div> " ;
?>
echo " <selectname=changeonchange='window.location="$url="+this.value'> " ;
for ( $i = 1 ; $i <= $pages ; $i ++ ){
if ( $i == $page ) echo " <optionvalue='$i'selected>$i/$pages</option> " ;
else echo " <optionvalue='$i'>$i/$pages</option> " ;
}
echo " </select> " ;
echo " </div> " ;
?>