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

$op=$_POST["op"];
$idList=$_POST["checkbox1"];
switch ($op){
case "选择删除":
    for($i=0; $i<count($idList); $i++){
	   $sql="select * from {$tablepre}ftblog_type where id=".$idList[$i];
       $rs=mysql_query($sql);
       $myrow = mysql_fetch_array($rs);
       $numrows = mysql_num_rows($rs);
	   if ($numrows!=0){
	   $userid=$myrow["userid"];
	   $photo_name=$myrow["blogtype"];
       $blogphoto=$myrow["blogphoto"];
	   mysql_query("delete from {$tablepre}ftbbs_upload where userid='".$userid."' and photo_name='".$photo_name."'");
	   mysql_query("delete from {$tablepre}ftblog_type where id='".$idList[$i]."'");
	   }
    }
	break;
case "选择显示":
    for($i=0; $i<count($idList); $i++){
	   $sql="select * from {$tablepre}ftblog_type where id=".$idList[$i];
       $rs=mysql_query($sql);
       $myrow = mysql_fetch_array($rs);
       $numrows = mysql_num_rows($rs);
	   if ($numrows!=0){
	   $userid=$myrow["userid"];
	   $photo_name=$myrow["blogtype"];

	   mysql_query("update {$tablepre}ftbbs_upload set sign=0 where userid='".$userid."' and photo_name='".$photo_name."'");
	   mysql_query("update {$tablepre}ftblog_type set sign=0 where id=".$idList[$i]);
	   }
    }
	break;
case "取消显示":
    for($i=0; $i<count($idList); $i++){
	   $sql="select * from {$tablepre}ftblog_type where id=".$idList[$i];
       $rs=mysql_query($sql);
       $myrow = mysql_fetch_array($rs);
       $numrows = mysql_num_rows($rs);
	   if ($numrows!=0){
	   $userid=$myrow["userid"];
	   $photo_name=$myrow["blogtype"];

	   mysql_query("update {$tablepre}ftbbs_upload set sign=1 where userid='".$userid."' and photo_name='".$photo_name."'");
	   mysql_query("update {$tablepre}ftblog_type set sign=1 where id=".$idList[$i]);
	   }
    }
	break;
}
$db->close(); 
header("Location:".$_SERVER["HTTP_REFERER"]);
?>