<?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("../loginstate.php");
SystemPer('0_1');
$ac=CS_Request("ac");
$op=CS_Request("op");
$id=CS_Request("id");
?>
<!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">
<div class="h_a">会员下载明细</div>
<form class="J_ajaxForm" action="?op=delall" method="post" name="formb">
<div class="table_list">
<table width="100%" id="dellist">
		<thead>
			<tr>
				<td><label>选</label></td>
				<td>歌曲名称</td>
				<td><span>下载会员</span></td>
				<td><span>扣金币</span></td>
				<td><span>下载IP</span></td>
				<td><span>下载时间</span></td>
				<td>删除</td>
			</tr>
		</thead>
<?php
		global $db;
                $sql="select * from ".Getdbname('down')." order by CS_AddTime desc";
		$dancenum=$db->num_rows($db->query($sql));
		$Arr=getpagerow($sql,20);//sql,每页显示条数
		$result=$db->query($Arr[2]);
		$adminnum=$db->num_rows($result);
	if($adminnum==0){
                   echo '<tr><td class="tac" colspan="7">啊哦，没有符合条件的内容！</td></tr>';
        }else{
                if($result){
	                 while ($row = $db ->fetch_array($result)){
?>
			   <tr>
				<td><input type="checkbox" class="J_check" name="CS_ID[]" value="<?php echo $row['CS_ID']?>" id="CS_ID"/>&nbsp;<?php echo $row['CS_ID']?></td>
				<td><a href="<?php echo LinkUrl('play','dance','id',1,$row['CS_DID'])?>" target="p"><?php echo $row['CS_Name']?></a></td>
				<td><a href="<?php echo userlink('index',getuser('uid',$row['CS_User']))?>" target="web"><?php echo $row['CS_User']?></a></td>
				<td><?php echo $row['CS_Cion']?></td>
				<td><?php echo $row['CS_Ip']?></td>
				<td><?php echo $row['CS_AddTime']?></td>
				<td><a style="cursor:pointer;"  onclick="del(<?php echo $row['CS_ID']?>)">删除</a></td>
			   </tr>
<?php
	                 }
                }
        }
?>
	</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('down')." 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('down')." 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>";
          }

?>
</div>
</body>
</html>
 

