<?php include("session.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理员后台管理 - 辰颐物语小袁团队留言板官方网站 Powered by xiaoyuanMessage</title>
<meta name="keywords" content="辰颐,辰颐物语,辰颐果园官网,辰颐物语微商,辰颐果园小袁,辰颐果园小袁团队,辰颐物语小袁团队,水果微商,加盟辰颐物语,PHP留言板,小袁留言板,模板,留言板模板,Powered by xiaoyuanMessage" />
<meta name="description" content="辰颐物语小袁团队留言板官方网站 - Powered by xiaoyuanMessage" />
</head>
<link href="css/common.css" rel="stylesheet" type="text/css" />
<link href="css/ly_manage.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="kindeditor/themes/default/default.css" />
<script charset="utf-8" src="kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="kindeditor/lang/zh_CN.js"></script>
<script charset="utf-8" src="js/input.js"></script>
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>


<body>
<?php 

include("head_common.php");

?>

<div class="contfram_canvas">
	<div class="cont_canvas">
		<a class="notice_title" >欢迎您 admin 管理员</a>  <a class="notice_title1" href="main.php" >系统设置</a> <a class="notice_title1" href="ly_manage.php" >留言管理</a>  <a class="notice_title1" href="changewd.php" >密码修改</a> <a class="notice_title1" href="loginout.php" >退出后台</a>
		<div class="noticeframe_canvas">
			<h3>留言管理</h3>
			<div class="about_canvas">
				<ul class="admin_canvas">
					<li>
						
						
					</li>

				</ul>
			</div>
		</div>
		
	<div class="ly_canvas">
			<!-- 留言板内容框架 -->
	<!--留言列表-->
<?php 
require ("link.php");
if ($page=="") {$page=1;};
$db=mysql_connect($se_name,$sedb_name,$db_pass) or die ("数据库连接失败");
mysql_select_db($db_name,$db);
$pagesize=10;  //定义每页显示多少条记录
$page=isset($_GET["page"])?intval($_GET["page"]):1;   //定义page的初始值,如果get 传过来的page为空,则page=1,
$total=mysql_num_rows(mysql_query("select * from ly  order by ly_id "));  //执行查询获取总记录数
$pagecount=ceil($total/$pagesize);  //计算出总页数
if ($page>$pagecount){
    $page=$pagecount;  // 对提交过来的page做一些检查
}
if ($page<=0){ 
    $page=1;                   // 对提交过来的page做一些检查
}
$offset=($page-1)*$pagesize;   //偏移量
$pre=$page-1;           //上一页
$next=$page+1;         //下一页
$first=1;                       //第一页
$last=$pagecount;    //末页
$exec="select * from ly order by ly_id desc limit $offset,$pagesize"; //执行查询
$result=mysql_query($exec);
while ($ly_data=mysql_fetch_array($result)){
   ?>
			<div class="ly_frame">
				<div class="ly_leftframe">
					<h3><?php echo $ly_data['name'];?></h3>
					<img src="<?php echo $ly_data['head'];?>" />
					<p>QQ号码 <?php echo $ly_data['qq'];?></p>
					<p>微信号 <?php echo $ly_data['weixin'];?></p>
				</div>
				<div class="ly_rightframe">
					<div class="ly_rightframe01">
						<p class="fbtime">发表于 <?php echo $ly_data['modi_date'];?></p>
						<p class="email">邮箱： <?php echo $ly_data['email'];?></p> <p><a class="modi" href="hf_ly.php?ly_id=<?php echo $ly_data['ly_id'];?>">【回复】</a></p> <p><a class="del" href="?act=del&ly_id=<?php echo $ly_data['ly_id'];?>">【删除】</a></p>

						<div class="content">
							 <?php echo $ly_data['content'];?>
						</div>
					
					<?php if(!empty($ly_data['hf_content'])){?>
						<div class="reply">
							<h3>管理员回复:</h3> <?php echo $ly_data['hf_content'];?>
                     
						</div>
					<?php }?>

					</div>
				</div>
			</div>
<?php 
}
?>			

			<!--分页 -->
			<div class="fenye_canvas">
				<p>页<?php echo $page."/".$pagecount?>总页&nbsp;</p><a href="?page=1">首页</a> <a href="?page=<?php echo $pre?>">上一页</a> <a href="?page=<?php echo $next?>">下一页</a> <a href="?page=<?php echo $last?>">尾页</a>
			</div>
		</div>
		
		
		
	</div>

</div>

<?php include("bottom_common.php");?>

<?php
//删除
$db=mysql_connect($se_name,$sedb_name,$db_pass) or die ("数据库连接失败");
mysql_select_db($db_name,$db);
if(isset($_GET['act']) && $_GET['act']=='del')
{
	$sql="delete from ly where ly_id=".$_GET['ly_id']."";
	mysql_query($sql);
	//echo $sql;
	die("<script>window.alert('删除成功！');window.document.location.href='ly_manage.php';</script>");
}
?>

</body>
</html>
