<?php 
	echo head('修改栏目前内容');
	if($admin != 1 && $admin != 2)
	{
		ehtml('您好，你无权进入此页面！');
		exit();
	}
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 '<div class="tip">修改成功</div>';
    }
	else
	{
		echo '<div class="tiip">修改失败!</div>';
    }
	$mysql = new D('class');
	$back = $mysql->where(array('cid'=>$_GET['cid'],'siteid'=>WAPID))->find();
    echo '<div class="content">';
	echo '<a href="../indexadmin.php?cid='.$back['gro'].'">';
	echo '排版页面';
	echo '</a></div>';
}
else
{ 	
	$mysql = new D('class');
	$back = $mysql->where(array('cid'=>$_GET['cid'],'siteid'=>WAPID))->find();
	if($back){
		echo "<div class=\"title\">".$back['cn']."(ID".$back['cid'].")</div>\n";
		echo "<div class=\"content\">\n";
		echo "<form method=\"post\" action=\"mod.php?mod=mod_q&action=mod&cid=".$_GET['cid']."\">";
		echo "<textarea type=\"text\" name=\"q\">".$back['q']."</textarea>";
		echo "<br><input type=\"submit\" value=\"确认修改\">";
		echo "</form>\n";
		echo "</div>";
	}
	else
	{
		echo '<div class="tip">此栏目不存在哦！</div>';
	}
	echo "<div class=\"mylink\"><a href=\"../indexadmin.php?cid=".$gro."\">返回页面综合排版</a></div>";

}
echo footer(1);