<?php
# Name: PHP版程氏音乐CMS管理系统 v3.0
# Author: 程氏<web@chshcms.com> [QQ:848769359]
# Homepage:http://www.chshcms.cn/
include_once("../../lib/cs_label.php");
include_once("../../lib/cs_phpzip.php");
include_once("../loginstate.php");
SystemPer('6_2');
$ac=CS_Request("ac");
$op=CS_Request("op");
$sid=CS_Request("sid");
$id=CS_Request("id");
if(empty($sid)) $sid=1;
?>
<!doctype html>
<html>
<head>
<meta charset="gbk">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>chshdjcms management</title>
<link href="../res/css/admin_style.css" rel="stylesheet" />
<link href="../../public/css/webox.css" rel="stylesheet" />
<script type="text/javascript" src="../res/js/ajax.js"></script>
<script language="javascript" src="../res/js/jquery.js"></script>
<script src="../../public/js/webox.js"></script>
<script language="javascript">
function del(_id){ 
  if (confirm("确定删除吗？")){
    window.location='?op=del&id='+_id;
    return true;
  }else{
     return false;
  }		
}
</script>
</head>
<body>
<div class="wrap">
<form class="J_ajaxForm" action="?op=delall" method="post" name="formb">
<div class="table_list">
<table width="100%" id="dellist">
		<thead>
			<tr>
				<td>留言管理</td>
			</tr>
		</thead><tr><td>
<?php
		global $db;
                $sql="select * from ".Getdbname('gbook')."  where cs_usera='csdjcms' and cs_cid=1  order by CS_AddTime desc";
		$dancenum=$db->num_rows($db->query($sql));
		$Arr=getpagerow($sql,10);//sql,每页显示条数
		$result=$db->query($Arr[2]);
		$adminnum=$db->num_rows($result);
	if($adminnum==0){
                   echo '<tr><td class="tac" colspan="6">啊哦，没有符合条件的内容！</td></tr>';
        }else{
                if($result){
	                 while ($row = $db ->fetch_array($result)){
?>
               		<div style="width:98%; border:1px solid #ccc; margin-top:10px;"><div style="width:100%; height:30px; line-height:30px; font-size:12px; background:#E0E0E0">
                        <div style="width:70%; float:left;  color:#185691; ">&nbsp;&nbsp;<input type="checkbox" class="J_check" name="CS_ID[]" value="<?php echo $row['CS_ID']?>" id="CS_ID"/>&nbsp;<strong><?php echo $row['CS_Userb']?></strong>&nbsp;&nbsp;IP：<?php echo $row['CS_Ip']?></div>
                        <div style="width:28%; float:left;text-align:right; font-size:12px;">留言时间:<font color=red><?php echo $row['CS_AddTime']?></font></div>
                    </div>
                    <div style="width:95%; margin:0 auto; height:80px; font-size:12px; line-height:25px; border-bottom:1px solid #CCC">&nbsp;<?php echo $row['CS_Neir']?></div>
                    	<div style="width:98%; height:20px; text-align:right; font-size:12px; line-height:20px;">&nbsp;
						[<a style="cursor:pointer" onclick="Popsboxif('回复留言',450,305,'gbook_hf.php?id=<?php echo $row['CS_ID']?>');"">回复</a>]&nbsp;
						[<a style="cursor:pointer" onclick="del(<?php echo $row['CS_ID']?>)">删除</a>]&nbsp;</div>
    <?php if($row['CS_FID']!="0" && trim($row['CS_Hfneir'])!=""){ ?>
                        <div style="font-size:12px; line-height:25px; width:95%;margin:0 auto;"><font color="red">&nbsp;站长回复:</font></div>
                        <div style="width:95%;margin:0 auto; line-height:25px; font-size:12px;">&nbsp;<?php echo $row['CS_Hfneir']?></div>
    <?php } ?>
                      </div>
<?php
	                 }
                }
        }
?>
                   </td></tr>
	</table>
			<div class="p10">
				<div class="pages">
				     <?php if($dancenum>20) echo $Arr[0];?>
                                </div>
			</div>
</div>
<div class="btn_wrap">
	<div class="btn_wrap_pd">
                <label class="mr20"><input type="checkbox" class="J_check_all" id="chkall" onClick="return CheckAll(this.form)" value="on">全选</label>
		<input name="button1" type="button" class="btn J_ajax_submit_btn" value="批量删除" onClick="DelInfo(this.form)">
                <div class="tips_error" id="Msg"></div>
	</div>
</div>
</form>
</div>
<?php
          //删除
          if($op=='del'){
		global $db;
		$CS_ID=CS_Request("id");
                $sql="delete from ".Getdbname('gbook')." where CS_ID=".$CS_ID;
		if($db->query($sql)){
                        echo '<script>document.getElementById("Msg").className="tips_success";$("#Msg").text("恭喜,删除成功!").css("color","#026E12");</script>';
	                echo "<script>setTimeout(\"window.location='javascript:history.go(-1);'\",2000);</script>";
		}
          }

          //批量删除
          if($op=='delall'){
		global $db;
		$CS_ID=CS_RequestBox("CS_ID");
	        $Arr=explode(',',$CS_ID);
		for($i=0;$i<count($Arr);$i++){
			$db->query("delete from ".Getdbname('gbook')." where CS_ID=".$Arr[$i]."");
		}
                        echo '<script>document.getElementById("Msg").className="tips_success";$("#Msg").text("恭喜,删除成功!").css("color","#026E12");</script>';
	                echo "<script>setTimeout(\"window.location='javascript:history.go(-1);'\",2000);</script>";
          }
?>
</body>
</html>
