<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">       <?php 
    
    require "../Run.php";
   echo head('添加网站栏目').'<body>'.UBB($wap_top,$wapid);
    if($login == 1){
    if($admin == 1||$admin==2){
	  if($_GET['action']=='add'){
	  $gro = $_GET['cid'];
	  if($gro == NULL){
	    $gro = 0;
		}
		if($_POST['xuhao'] == '' || $_POST['xuhao'] == NULL){
		   $xuhao = 0;
		   }else{
		   $xuhao = $_POST['xuhao'];
		   }
	if($_POST['cn'] == '' || $_POST['cn']==NULL){
	    echo '栏目名称为空，拒绝添加栏目！';
		}else{
      	$sql="INSERT INTO class(cn,url,siteid,q,xuhao,gro,list,top,bottom)VALUES ('{$_POST["cn"]}','{$_POST["url"]}','{$wapid}','{$_POST["q"]}','{$xuhao}','{$gro}','{$_POST["list"]}','','')";
	     $class = mysql_query($sql);
         if($class && mysql_affected_rows()>0){
	     if($_POST['xuhao'] == ''||$_POST['xuhao'] == NULL){
			$AutoID = mysql_insert_id();
			$sql = "UPDATE class SET xuhao='{$AutoID}' WHERE cid='{$AutoID}' AND siteid={$wapid}";
               $result = mysql_query($sql);
		 }
	     echo "<div class=\"tip\">"; 
         echo "成功添加栏目<br>";
	     echo "</div>";
	     }else{
	     echo "添加失败!请重试或者联系网站管理员！";
	             }
		    }
	  }else{
	   function mk_list(){
	  $sql="SELECT id,name,url,list,time FROM mkinfo";
      $result = mysql_query($sql);
      while(list($mk_id,$mk_name,$mk_url,$mk_list,$mk_time) = mysql_fetch_row($result)){
	    $html_list.='<option value="'.$mk_id.'">'.$mk_name.'</option>';
	
	    }
		return $html_list;
	} 
	  echo '<div class="subtitle"><form method="get" action="more_class.php">
	        添加
	        <input type="text" name="nums" value="5" style="width:50px;"/>
			<input type="hidden" name="cid" value="'.$_GET['cid'].'"/>
			<input type="hidden" name="sid" value="'.$sid_info.'"/>
			<input type="submit" value="个栏目"/></form></div>';
	  echo"<div class=\"content\">
	  <form method=\"post\" action=\"class.php?action=add&cid=".$_GET['cid']."\">
栏目名称<br>
<input type=\"text\" name=\"cn\" value=\"\"><br>
指向模块<br>
<select name=\"url\" >
".mk_list()."
</select><br>
栏目前内容[支持UBB]<br>
<input type=\"text\" name=\"q\" value=\"\"><br>
是否隐藏<br>
<select name=\"list\" >
<option value=\"0\">[1]否</option>
<option value=\"1\">[2]是</option>
</select><br>
栏目序号<br>
<input type=\"text\" name=\"xuhao\" value=\"\"><br>
<input type=\"submit\" value=\"提交\"></form></div>";
      }
  }else{
	echo "您好，您不是管理员";
	  }
	}else{
	echo "您好，请登录";
	  }
	echo "<div class=\"mylink\"><a href=../indexadmin.php?cid=".$_GET['cid']."&sid=".$sid_info.">返回页面综合排版</a>|<a href=\"../index.php?\">网站首页</a></div>";
	echo UBB($wap_bottom,$wapid);			 
	?>
  </body>
</html>
