<?php
	session_start();
	include "../inc/chec.php";
	include "../conn/conn.php";
?>
<link href="../css/style.css" rel="stylesheet" />
<script src="../js/client_js.js"></script>
<script type="text/javascript" src="../lhgcore.js"></script>
<script type="text/javascript" src="../lhgdialog.js"></script>
<table width="765" border="0" cellpadding="0" cellspacing="0" class="big_td">
	<tr>
		<td height="33" background="../images/list.jpg" id="list">消息管理
		</td>
	</tr>
</table>
<table width="765" border="0" cellspacing="0" cellpadding="0" bgcolor="#DEEBEF" class="big_td">
  <tr>
    <td width="100" height="25" align="center" valign="middle" scope="col">发布时间</td>
    <td height="25" align="center" valign="middle" scope="col">标题</td>
	<td width="150" height="25" align="center" valign="middle" scope="col">操作</td>
  </tr>
  <?php
$met=$_GET['u_id'];
$spendor=($met=='srlist')?2:1;
$page=isset($_GET['page'])?(int)($_GET['page']):1;
$num=10;
$total=mysql_num_rows(mysql_query("SELECT id,p_time,p_title from tb_person"));
                    $url = 'p_manage.php';
                    if ($total <= 0)
                        exit('还没有你的记录，快去记录吧');
//页码计算
$pagenum=ceil($total/$num);
$page=min($pagenum,$page);//获得首页
$prepg=$page-1;//上一页
$nextpg=($page==$pagenum?0:$page+1);//下一页
$offset=($page-1)*$num;
//开始分页导航条代码：
$pagenav="<div class=num>显示第 <B>".($total?($offset+1):0)."</B>-<B>".min($offset+10,$total)."</B> 条记录，共 $total 条记录 ";
$pagenav.=" <a href='$url?u_id=$met&page=1'>首页</a> ";
if($prepg) $pagenav.=" <a href='$url?u_id=$met&page=$prepg'>前页</a> "; else $pagenav.=" 前页 ";
if($nextpg) $pagenav.=" <a href='$url?u_id=$met&page=$nextpg'>后页</a> "; else $pagenav.=" 后页 ";
$pagenav.=" <a href='$url?u_id=$met&page=$pagenum'>尾页</a> ";
//下拉跳转列表，循环列出所有页码：
$pagenav.="　到第 <select name='topage' size='1' onchange='window.location=\"$url?u_id=$met&page=\"+this.value'>\n";
for($i=1;$i<=$pagenum;$i++){
if($i==$page) $pagenav.="<option value='$i' selected>$i</option>\n";
else $pagenav.="<option value='$i'>$i</option>\n";
}
$pagenav.="</select> 页，共 $pagenum 页</div>";
//假如传入的页数参数大于总页数，则显示错误信息
If($page>$pagenum){
       echo "Error : 不能找到页 ".$page;
       Exit;
}
$info="SELECT id,p_time,p_title from tb_person order by id desc limit $offset,$num";
$result3=mysql_query($info,$conn);
$j=0;
while($list=mysql_fetch_array($result3)){
$j++;
echo "<tr><td height=30 style='text-indent: 30px;'>".$list['p_time']."</td><td height=30 style='text-indent: 30px;'>".$list['p_title']."</td><td><a href='m_message.php?id=".$list['id']."'>修改</a>/<a href='d_message_chk.php?id=".$list['id']."' onclick='return del_mess();'>删除</a></td></tr>";}
echo $pagenav;//输出分页导航
ob_end_flush();
?>
<tr>
	<td height="30" align="right" valign="middle" colspan="3"><a href='add_manage.php' target="mainFrame">发布新消息</a></td>
</tr>
</table>
</center>