<?php 
echo head('修改栏目前内容');
   if($admin != 1 && $admin != 2){
     die('您好，你无权进入此页面！');
	 }
if($_GET['action'] == 'mod'){
   $sql="UPDATE class SET q='{$_POST['q']}' WHERE cid='{$_GET['cid']}'";
   $result = mysql_query($sql);
	if($result && mysql_affected_rows()>0){
	echo "修改成功";
    }else{
    echo "修改失败";
    }
	@mysql_free_result($result);
	$sql="SELECT cid,siteid,gro FROM class WHERE cid='{$_GET["cid"]}' AND siteid='{$wapid}'";
	$qcon=mysql_query($sql);
	list($cid,$siteid,$gro) = mysql_fetch_row($qcon);
    echo '<div class="content"><a href="../indexadmin_web.php?cid='.$gro.'">排版页面</a></div>';
}else{ 
 $sql="SELECT cid,siteid,cn,q,gro FROM class WHERE cid='{$_GET["cid"]}' AND siteid='{$wapid}'";
	$qcon=mysql_query($sql);
	/*数据验证*/
	if($qcon && mysql_num_rows($qcon)>0){
	list($cid,$siteid,$cn,$q,$gro) = mysql_fetch_row($qcon);
    echo "<form method=\"post\" action=\"mod.php?mod=mod_q_web&action=mod&cid=".$_GET['cid']."\">";
	echo "<div class=\"system_title\" style=\"line-height:40px;background:#efefef;border:1px solid #ccc;\">";
	echo "<a href=\"../indexadmin_web.php?cid=".$gro."\">返回页面排版</a> 
	<input type=\"submit\" value=\"保存修改\">【栏目信息:".$cn."(ID".$cid.")】</div>
 <textarea type=\"text\" name=\"q\" style=\"width:100%;height:300px;\">".$q."</textarea>
</form>";
  }else{
  echo '<div class="tip">此栏目不存在哦！</div>';
  }
     mysql_free_result($qcon);
}
echo footer(1);