<?PHP
/*
* Copyright (c) www.baojisky.com All rights reserved. 
*/
$root_path='../..';
include($root_path.'/php/connect_sub.php');
include($root_path.'/php/sub.php');
include($root_path."/php/img_sub.php");
include($root_path.'/php/page_sub_old.php');
include($root_path.'/admin/check.php');
 

$file_path_pdf		=	$root_path."/upload/paper_file/";  //上传pdf附件路径
$file_path_pic  	=	$root_path."/upload/paper_data/";  //上传图片附件路径




			//板块数据
			$result_ban	=	$db->query("SELECT * from {$db_sux}papers_ban where bid='$bid'  ");
			$ban_numberz	=	$db->num_rows($result_ban);
			if($ban_numberz>0)
			{
  		  $gb_ban = $db->fetch_array($result_ban);
				
					//删除报纸版面图片
			 		if($gb_ban[ban_pic]!=null and $gb_ban[ban_pic]!='')
			 		{
			 			$filename_del	=	$file_path_pdf.$gb_ban[ban_pic];//大图
						$tt	=	unlink($filename_del);
						$filename_del	=	$file_path_pdf.'s'.$gb_ban[ban_pic]; //小图
						$tt	=	unlink($filename_del);
			 		}
			 		//板块新闻数据
			 		$result_news	=	$db->query("SELECT * from {$db_sux}papers_news where bid='$gb_ban[bid]'  ");
					$news_numberz	=	$db->num_rows($result_news);
					if($news_numberz>0)
					{
  		  		while($gb_news = $db->fetch_array($result_news))
						{
			 				//新闻图片数据
			 				$result_pic	=	$db->query("SELECT * from {$db_sux}papers_upfile where nid='$gb_news[nid]'  ");
							$pic_numberz	=	$db->num_rows($result_pic);
							if($pic_numberz>0)
							{
  		  				while($gb_pic = $db->fetch_array($result_pic))
								{
			 						//删除图片数据
					 				if($gb_pic[upfile]!=null and $gb_pic[upfile]!='')
			 						{
			 							  $filename_del	=	$file_path_pic.$gb_pic[upfile];//大图
											$tt	=	unlink($filename_del);
											$filename_del	=	$file_path_pic.$gb_pic[supfile];//小图
											$tt	=	unlink($filename_del);
			 						}
			 						$db->query("delete from {$db_sux}papers_upfile WHERE id='$gb_pic[id]'");//删除图片数据
			 					}
			 				}
			 				$db->query("delete from {$db_sux}papers_news WHERE nid='$gb_news[nid]'");//删除新闻数据
			 			}
			 		}
			 		$db->query("delete from {$db_sux}papers_ban WHERE bid='$gb_ban[bid]'");//删除新闻数据				
			}
		
	

web_echo("操作成功!","Newspaper_ban_list.php?page=$page&qid=$qid",'2',"$root_path",'info1');exit(0);

echo $fgoutputstr;
?>