<?php include 'yanzheng.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>管理中心</title>
<link rel="stylesheet" type="text/css" href="css.css" />

<script language="javascript" type="text/javascript">
function preg_match(regStr, str)
{
     var objRegExp = new RegExp(regStr);
     return objRegExp.test(str);
}
function SelectAll(form)
{
for(var j = 0;j < form.elements.length;j++)
     {
         var e = form.elements[j];
         if(preg_match(/del_id/, e.name))
         {
             e.checked = form.select_all.checked;
         }
         else
         {
             continue;
         }
     }
}
</script>
</head>

<body>
<?php require_once 'head.php';?>
<div class="box">

   

		<div class="daohang">
		 <a href="danye_add.php">添加单页</a>
		</div>
	


	 	<form name="del_form" action="" method="post"> 
	
	<table width="100%" height="40" border="0" cellpadding="0" cellspacing="0"   class="borer">
	  <tr style="background-color:#EEEEEE;">
	    <td width="80" height="31" >选择</td>
		<td width="80" height="31" >ID</td>
		<td width="783" >标题</td>
		<td width="70" >修改</td>
		
	  </tr>

	<!--list start-->	



<?php 	
 
			$arr=listquery("select * from danye order by id desc");
			foreach ($arr as $v){?>
	  <tr>
		<td width="80" ><input name="del_id[]" type="checkbox" id="del_id[]" value="<?=$v['id']?>" /></td>
		<td width="143" ><?=$v['id']?></td>
		<td width="783" ><a href="danye_up.php?id=<?=$v[id]?>"><?=$v[title]?></a></td>		
	
		
		<td width="70" ><a href="danye_up.php?id=<?=$v[id]?>">修改</a></td>
		
	  </tr>
   
	<?php }?>
 </table>    
  
	<table width="433" height="28" border="0" cellpadding="0" cellspacing="0" style="margin-top:20px;">
	  <tr>	
	    <td width="49">全选</td>
		<td width="49"><input id="select_all" name="select_all" type="checkbox" value="1" onClick="SelectAll(this.form)"/></td>
	    <td width="354" style="margin-left:10px;"><input name="submitdel" type="submit" value="批量删除" class="reganniu" /></td>
		
	  </tr>
	</table>
	 

	 </form>








  <?php
if($_POST['submitdel']){

$del_id=$_POST['del_id'];
     if($del_id!=""){ 
             $del_num=count($del_id); 
             for($i=0;$i<$del_num;$i++){ 
                 mysql_query("Delete from danye where id='$del_id[$i]'"); 				
             }  
             msg('删除成功','danye.php');
      }else{ 
             msg('请选择','danye.php');
      }

  }
?>  

</div>

<?php require_once 'foot.php';?>
</body>
</html>