⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 article_del.php

📁 程序安装简便容易
💻 PHP
字号:
<?php
!$_SERVER['PHP_SELF'] && $_SERVER['PHP_SELF']=$_SERVER['SCRIPT_NAME'];
substr($_SERVER['PHP_SELF'],-9,-4)!=='admin' && exit('Forbidden');

include_once(R_P.'cache/sortcache.php');

if(!empty($_GET['do'])) {
	if($_GET['do']=='do') {
		$sid=$_POST['sid'];
		$ifkeep=$_POST['ifkeep'];
		$postdate=$_POST['postdate'];
		$hits=$_POST['hits'];
		$comments=$_POST['comments'];
		$author=$_POST['author'];
		$keyword=$_POST['keyword'];
		$userip=$_POST['userip'];
		$perpage=$_POST['perpage'];
		$direct=!empty($_POST['direct']) ? $_POST['direct'] : 0;

		if($direct) {
			if(!$postdate && !$hits && !$comments && !$author && !$keyword && !$userip) {
				echo "<script language=\"javascript\">alert(\"没有提供足够的条件!请填写搜索条件!\")</script>";
				echo "<meta http-equiv='refresh' content='0;url=admin.php?job=article_del'>";
				exit;
			} else {
				$sql=$sid ? "WHERE sid=$sid" : "WHERE sid!=-1";
				$ifkeep && $sql.=" AND topped=0";
				if($postdate) {
					$schtime=$timestamp-$postdate*24*3600;
					$sql.=" AND postdate<$schtime";
				}
				$hits && $sql.=" AND hits<".(int)$hits;
				$comments && $sql.=" AND cnum<".(int)$comments;
				if($author){
					$authorarray=explode(",",$author);
					$authorwhere='';
					foreach($authorarray as $value){
						$value=addslashes(str_replace('*','%',$value));
						$authorwhere.=" OR author LIKE '$value'";
					}
					$authorwhere=substr_replace($authorwhere,"",0,3);
					$sql.=" AND ($authorwhere)";
				}
				if($keyword){
					$keyword=trim($keyword);
					$keywordarray=explode(",",$keyword);
					$keywhere='';
					foreach($keywordarray as $value){
						$value=str_replace('*','%',$value);
						$keywhere.='OR';
						$keywhere.=" subject LIKE '%$value%' ";
					}
					$keywhere=substr_replace($keywhere,"",0,3);
					$sql.=" AND ($keywhere) ";	
				}
				if($userip){
					$userip=str_replace('*','%',$userip);
					$sql.=" AND (userip LIKE '$userip') ";
					$ip_add=',userip';
				}
				$query=query("SELECT aid FROM duoxun_subject $sql");
				while($rs=fetch_array($query)) {
					$aids[]=$rs['aid'];
				}
				if(!empty($aids)) {
					foreach($aids as $aid) {
						query("DELETE FROM duoxun_subject WHERE aid='$aid'");
						query("DELETE FROM duoxun_content WHERE aid='$aid'");
						query("DELETE FROM duoxun_comment WHERE aid='$aid'");
					}
					echo "<script language=\"javascript\">alert(\"删除成功!\")</script>";
					echo "<meta http-equiv='refresh' content='0;url=admin.php?job=article_del'>";
					exit;
				} else {
					echo "<script language=\"javascript\">alert(\"没有找到符合搜索条件的记录!\")</script>";
					echo "<meta http-equiv='refresh' content='0;url=admin.php?job=article_del'>";
					exit;
				}
			}
		} else {
			$addurl='';
			$sid && $addurl.="&sid=$sid";
			$ifkeep && $addurl.="&ifkeep=$ifkeep";
			$postdate && $addurl.="&postdate=$postdate";
			$hits && $addurl.="&hits=$hits";
			$comments && $addurl.="&comments=$comments";
			$author && $addurl.="&author=$author";
			$keyword && $addurl.="&keyword=$keyword";
			$userip && $addurl.="&userip=$userip";
			$perpage && $addurl.="&perpage=$perpage";

			echo "<meta http-equiv='refresh' content='0;url=admin.php?job=article_del&do=show$addurl'>";
			exit;
		}
	} elseif($_GET['do']=='show') {
		$sid=!empty($_GET['sid']) ? $_GET['sid'] : 0 ;
		$ifkeep=!empty($_GET['ifkeep']) ? $_GET['ifkeep'] : 0;
		$postdate=!empty($_GET['postdate']) ? $_GET['postdate'] : 0;
		$hits=!empty($_GET['hits']) ? $_GET['hits'] : 0;
		$comments=!empty($_GET['comments']) ? $_GET['comments'] : 0;
		$author=!empty($_GET['author']) ? $_GET['author'] : 0;
		$keyword=!empty($_GET['keyword']) ? $_GET['keyword'] : 0;
		$userip=!empty($_GET['userip']) ? $_GET['userip'] : 0;
		$perpage=!empty($_GET['perpage']) ? $_GET['perpage'] : 0;

		$addurl='';
		$sid && $addurl.="&sid=$sid";
		$ifkeep && $addurl.="&ifkeep=$ifkeep";
		$postdate && $addurl.="&postdate=$postdate";
		$hits && $addurl.="&hits=$hits";
		$comments && $addurl.="&comments=$comments";
		$author && $addurl.="&author=$author";
		$keyword && $addurl.="&keyword=$keyword";
		$userip && $addurl.="&userip=$userip";
		$perpage && $addurl.="&perpage=$perpage";

		if(!$postdate && !$hits && !$comments && !$author && !$keyword && !$userip) {
			echo "<script language=\"javascript\">alert(\"没有提供足够的条件!请填写搜索条件!\")</script>";
			echo "<meta http-equiv='refresh' content='0;url=admin.php?job=article_del'>";
			exit;
		} else {
			$sql=$sid ? "WHERE sid=$sid" : "WHERE sid!=-1";
			$ifkeep && $sql.=" AND topped=0";
			if($postdate) {
				$schtime=$timestamp-$postdate*24*3600;
				$sql.=" AND postdate<$schtime";
			}
			$hits && $sql.=" AND hits<".(int)$hits;
			$comments && $sql.=" AND cnum<".(int)$comments;
			if($author){
				$authorarray=explode(",",$author);
				$authorwhere='';
				foreach($authorarray as $value){
					$value=addslashes(str_replace('*','%',$value));
					$authorwhere.=" OR author LIKE '$value'";
				}
				$authorwhere=substr_replace($authorwhere,"",0,3);
				$sql.=" AND ($authorwhere)";
			}
			if($keyword){
				$keyword=trim($keyword);
				$keywordarray=explode(",",$keyword);
				$keywhere='';
				foreach($keywordarray as $value){
					$value=str_replace('*','%',$value);
					$keywhere.='OR';
					$keywhere.=" subject LIKE '%$value%' ";
				}
				$keywhere=substr_replace($keywhere,"",0,3);
				$sql.=" AND ($keywhere) ";	
			}
			if($userip){
				$userip=str_replace('*','%',$userip);
				$sql.=" AND (userip LIKE '$userip') ";
				$ip_add=',userip';
			}
			$rs=get_one("SELECT COUNT(*) AS count FROM duoxun_subject $sql");
			$num=$rs['count'];
			$perpage=!$perpage ? 35 : $perpage;
			$pages=ceil($num/$perpage);
			if(empty($_GET['page']) || $_GET['page']<1) {
				$page=1;
				$start=0;
			} elseif($_GET['page']>$pages) {
				$page=$pages;
				$start=($page-1)*$perpage;
			} else {
				$page=$_GET['page'];
				$start=($page-1)*$perpage;
			}
			$mpurl='admin.php?job=article_del&do=show'.$addurl;
			$fenye=admin_fenye($num,$perpage,$page,$mpurl,0);
			$query=query("SELECT * FROM duoxun_subject $sql LIMIT $start,$perpage");
			while($rs=fetch_array($query)) {
				$catedb[]=$rs;
			}
			$query=query("SELECT * FROM duoxun_sort ORDER BY vieworder ASC,sid ASC");
			while($rs=fetch_array($query)) {
				$sortdb[$rs['sid']]=$rs;
			}
		}			
	} elseif($_GET['do']=='del') {
		$addurl=$_POST['addurl'];
		$aids=$_POST['aids'];
		foreach($aids as $aid) {
			query("DELETE FROM duoxun_subject WHERE aid='$aid'");
			query("DELETE FROM duoxun_content WHERE aid='$aid'");
			query("DELETE FROM duoxun_comment WHERE aid='$aid'");
		}
		echo "<script language=\"javascript\">alert(\"删除成功!\")</script>";
		echo "<meta http-equiv='refresh' content='0;url=admin.php?job=article_del&do=show$addurl'>";
		exit;
	}
}

require_once template('article_del','admin');

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -