<?php 
echo head("修改底部");
   if($admin != 1&&$admin!=2){
     die('您好，你无权进入此页面！');
	 }
   if($_GET['action']  == 'mod'){
   if($_GET['cid'] == NULL || $_GET['cid'] == 0){
   $sql = "UPDATE config SET index_bottom='{$_POST['b']}' WHERE user='{$wapid}'";
   }else{
   $sql = "UPDATE class SET bottom='{$_POST['b']}' WHERE cid='{$_GET['cid']}' AND siteid='{$wapid}'";
   }
   $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.php?cid='.$_GET['cid'].'">排版页面</a></div>';
	}else{ 
    if($_GET['cid'] == NULL || $_GET['cid'] == 0)
	{
	                      $b = $cfginfo['index_bottom'];
	}else{
		$sql="SELECT cid,siteid,cn,bottom,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,$b,$gro) = mysql_fetch_row($qcon);
		}
	}
    echo "<div class=\"title\">底部内容排版[支持UBB]</div>
	<div class=\"content\">
    <form method=\"post\" action=\"mod.php?mod=mod_b&action=mod&cid=".$_GET['cid']."\">
    <textarea name=\"b\" >".$b."</textarea><br>
    <input type=\"submit\" value=\"确认修改\">
    </form></div>";
	 echo "<div class=\"mylink\"><a href=\"../indexadmin.php?cid=".$_GET['cid']."\">返回页面综合排版</a></div>";

    }
    echo footer(1);
?>