<?
include_once("../inc/config.php");
include_once("../inc/publicfun.php");
include_once("../inc/ftbbsdbclass.php");
include_once("../conn.php");
include_once("check_master.php");
include_once("check_admin_qs.php");

$id=$_GET["id"];
$reid=$_GET["reid"];
$sign=$_GET["sign"];

$sql="select BoardID_1,BoardID_2 from {$tablepre}bbsmenu where id=".$reid;
$rs=mysql_query($sql);
$myrow = mysql_fetch_array($rs);
$BoardID_1=$myrow["BoardID_1"];
$BoardID_2=$myrow["BoardID_2"];
if ($sign==""){
mysql_query("update {$tablepre}bbs_cate set BBS_Cate_Reply=BBS_Cate_Reply-1 where BBS_Cate_ID='".$BoardID_1."'");
mysql_query("update {$tablepre}bbs_cate set BBS_Cate_Reply=BBS_Cate_Reply-1 where BBS_Cate_ID='".$BoardID_2."'");
mysql_query("update {$tablepre}bbstitle set rep=rep-1,postnum=postnum-1 where rep>0 and id='".$id."'");
mysql_query("delete from {$tablepre}bbsmenu where id='".$reid."'");
}
elseif ($sign==0){
mysql_query("update {$tablepre}bbs_cate set BBS_Cate_Reply=BBS_Cate_Reply+1 where BBS_Cate_ID='".$BoardID_1."'");
mysql_query("update {$tablepre}bbs_cate set BBS_Cate_Reply=BBS_Cate_Reply+1 where BBS_Cate_ID='".$BoardID_2."'");
mysql_query("update {$tablepre}bbstitle set rep=rep+1,postnum=postnum+1 where id='".$id."'");
mysql_query("update {$tablepre}bbsmenu set deleted=0 where id='".$reid."'");
}
elseif ($sign==1){
mysql_query("update {$tablepre}bbs_cate set BBS_Cate_Reply=BBS_Cate_Reply-1 where BBS_Cate_ID='".$BoardID_1."'");
mysql_query("update {$tablepre}bbs_cate set BBS_Cate_Reply=BBS_Cate_Reply-1 where BBS_Cate_ID='".$BoardID_2."'");
mysql_query("update {$tablepre}bbstitle set rep=rep-1,postnum=postnum-1 where rep>0 and id='".$id."'");
mysql_query("update {$tablepre}bbsmenu set deleted=1 where id='".$reid."'");
}
$db->close(); 
header("Location:".$_SERVER["HTTP_REFERER"]);
?>