<?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"]);
$postuser=ftbbs_request($_GET['postuser']);
$query = "SELECT * FROM {$tablepre}ftbbsmb";
$ftbbsmb=makecache('ftbbsmb.html',$query,$expire);
$postget=$ftbbsmb[48];

$sql="select {$tablepre}bbstitle.title,{$tablepre}bbs_cate.BBS_Cate_Manager_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);

$title=$myrow["title"];
$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 (get_cookie('bz')==1 || $admintobz==1){
   mysql_query("update {$tablepre}bbstitle set deleted=1 where id='".$id."'");
   mysql_query("update {$tablepre}clubuser set jingyuan=jingyuan-'".$postget."' where jingyuan>0 and clubuser_name='".$postuser."'");
   sendsms($username,$postuser,$id,$title,5);
   include_once("delcache.php");
   header("Location:default.php");
}
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>";  
}
?>