<?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.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">

		
		
<form action="" method="post">
	 <table width="100%" height="111" class="tbdd">		 
		  <tr>
			<td width="143" height="30">批量添加子栏目</td>
			<td width="628">
			 <textarea name="typename" style="height:60px; width:600px;font-family: Microsoft YaHei; ">栏目1|栏目2|栏目3</textarea> <font color="red">用竖线分割 开头结尾不能有竖线</font>
			</td>			
		  </tr>	
		  <tr>
			<td width="143" height="30"></td>
			<td width="628">			
			 <input name="submitadd" type="submit" class="anniu"  value="添加" /></td>			
		  </tr>	 
	  </table>
	 </form>
	 <!--上面是插入分类--> 
	



 <?php
$add_id=$_GET['add_id'];
 
if($_POST['submitadd']){
     
        $typename=$_POST['typename'];
		$typename=trim($typename);
	    $typename = str_replace(array("\r\n", "\r", "\n"), "", $typename);	   
	    $namec=explode('|',$typename);
	    $u=query("SELECT * FROM news_type where id='$add_id'");//查询父栏目
		$tongji= count(explode('|',$typename));
		for($i=0;$i<$tongji;$i++){ 	   
				
				mysql_query("INSERT INTO news_type (fid,typename) VALUES ('$add_id','$namec[$i]')");  
		        $m=mysql_insert_id();								
				$benpath=$u['benpath'].$m.'-'; //取得父路径	并组合
				mysql_query("update news_type set benpath='$benpath' where id='$m'");				
				
		}
	msg('添加成功','news_type.php');
}
?>
<!--批量添加子栏目-->   
		
		
		
		
		
<!--批量删除-->

</div>

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