<?php
require_once('../../include/class.inc.php'); 


if($ID=$_GET["ID"]){



//--------------------------------------------------------------------------------------
						$sqll="select * from news where ID=".$ID;//查要修改的原数据
						$resultt=mysql_query($sqll);//执行sql
						$rs=mysql_fetch_array($resultt);//提取数组
						$lujing="../".$rs['img'];//定义图片的完整路径
						if(file_exists($lujing)){//判断图片文件是否存在
							@unlink($lujing);//物理删除
							//echo "原图物理删除成功 ";//提示成功
						}
//--------------------------------------------------------------------------------------
$sql="delete from news where ID='$ID'";
$result=$my->data_work($sql); 
}else{
						$ID=$_POST['checkbox'];						
						foreach ($ID as $i){
					
						//--------------------------------------------------------------------------------------
						$sqll="select * from news where ID=".$i;//查要修改的原数据
						$resultt=mysql_query($sqll);//执行sql
						$rs=mysql_fetch_array($resultt);//提取数组
						$lujing="../".$rs['img'];//定义图片的完整路径
						if(file_exists($lujing)){//判断图片文件是否存在
							unlink($lujing);//物理删除
							//echo "原图物理删除成功 ";//提示成功
						}
//--------------------------------------------------------------------------------------
						
						
							$sql="delete from news where ID='$i'";
							$result=$my->data_work($sql); 
						}
						if($result){
						echo "<script>alert('成功删除选中记录!');history.back();</script>";}
}
if($result)
{
	echo ("<script type='text/javascript'>alert('删除成功！！');location.href='news.php';</script>");
}
else
{
	echo ("<script type='text/javascript'>alert('删除失败！！');location.href='news.php';</script>");
}
?>