<?php
include_once("inc/config.php");
include_once("inc/ftbbsdbclass.php");
include_once("inc/publicfun.php");
include_once("conn.php");
include_once("touxianfun.php");
include_once("checkuser.php");
if (checkuserlogin()=="N"){
   header("Location:userlogin.php?flag=Y");
}
$id=intval($_GET["id"]);
$query = "SELECT * FROM {$tablepre}ftbbsmb";
$ftbbsmb=makecache('ftbbsmb.html',$query,$expire);
$tjvalue=$ftbbsmb[57];
$clubuser_id=get_cookie('clubuser_id');
$cookiesbz=get_cookie('bz');
$topqs=jingyuantoqs($clubuser_id,$tjvalue);

$sql="select {$tablepre}bbs_cate.BBS_Cate_Manager_Name,{$tablepre}bbstitle.name from {$tablepre}bbs_cate,{$tablepre}bbstitle where {$tablepre}bbs_cate.BBS_Cate_ID = {$tablepre}bbstitle.BoardID_2 and {$tablepre}bbstitle.ID='".$id."'";
$rs=mysql_query($sql);
$myrow = mysql_fetch_array($rs);
$numrows = mysql_num_rows($rs);

$postuser=$myrow["name"];
$myname=$myrow["BBS_Cate_Manager_Name"];
$admintobz=0;
$username=get_cookie('username');
if (strrpos($myname,"|")){
	$arr=explode("|",$myname);
    for($i=0; $i<count($arr); $i++){
	if ($arr[$i]==$username){
	   $admintobz=1;
	   }
    }
}
elseif($myname==$username){
    $admintobz=1;
}
if (($topqs==1 && $postuser==$username) || $cookiesbz==1 || $admintobz==1){  
   mysql_query("update {$tablepre}bbstitle set sign=0 where id='".$id."'");
   echo "<script language='javascript'>history.go(-1);</script>";
}
else{
   echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
   echo "<script language='javascript'>";
   echo "alert('你的权限太低，无法使用此功能!');";
   echo "history.go(-1);";
   echo "</script>"; 
}
?>