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

📄 superdel.php

📁 一个可以实时查看股票行情的小程序,真是一个好程序哦,直得大家
💻 PHP
字号:
<?php
!function_exists('adminmsg') && exit('Forbidden');

require_once(R_P.'require/forum.php');
if($a_type=='article'){
	$basename="admin.php?adminjob=superdel&a_type=article";
	getallowforum($admin_name);
	if(empty($action)){
		include PrintEot('superdel');exit;
	} elseif($action=='deltpc'){
		if(empty($_POST['step'])){
			if($fid=='-1' && !$postdate && !$tcounts && !$counts && !$lastpost && !$hits && !$replies && !$author && !$keyword && !$userip){
				adminmsg('noenough_condition');
			} else{
				unset($sqltable,$ip_add);
				if($fid=='-1'){
					$sql="t.fid IN($allowfid)";
				} elseif(is_numeric($fid)){
					if(strpos($allowfid,$fid)===false){
						adminmsg('forum_right');
					} else{
						$sql="t.fid='$fid'";
					}
				} else{
					adminmsg('forumid_error');
				}
				if($ifkeep){
					$sql.=" AND t.topped=0 AND t.digest=0"; 
				}
				if($postdate){
					$schtime=$timestamp-$postdate*24*3600;
					$sql.=" AND t.postdate<$schtime";
				}
				if($lastpost){
					$schtime=$timestamp-$lastpost*24*3600;
					$sql.=" AND t.lastpost<$schtime";
				}
				$hits    && $sql.=" AND t.hits<".(int)$hits;
				$replies && $sql.=" AND t.replies<".(int)$replies;
				if($tcounts){
					$sql.=" AND char_length(tm.content)>".(int)$tcounts;
				}elseif($counts){
					$sql.=" AND char_length(tm.content)<".(int)$counts;
				}
				if($tcounts || $counts || $userip){
					$sqltable ="LEFT JOIN pw_tmsgs tm ON  tm.tid=t.tid";
				}
				if($author){
					$authorarray=explode(",",$author);
					foreach($authorarray as $value){
						$value=addslashes(str_replace('*','%',$value));
						$authorwhere.=" OR t.author LIKE '%$value%'";
					}
					$authorwhere=substr_replace($authorwhere,"",0,3);
					$sql.=" AND ($authorwhere)";
				}
				if($keyword){
					$sqltable ="LEFT JOIN pw_posts p ON  p.tid=t.tid LEFT JOIN pw_tmsgs tm ON  tm.tid=t.tid";
					$keyword=trim($keyword);
					$keywordarray=explode(",",$keyword);
					foreach($keywordarray as $value){
						$value=str_replace('*','%',$value);
						$keywhere.='OR';
						$keywhere.=" tm.content LIKE '%$value%' OR p.content LIKE '%$value%' OR p.subject LIKE '%$value%' ";
					}
					$keywhere=substr_replace($keywhere,"",0,3);
					$sql.=" AND ($keywhere) ";	
				}
				if($userip){
					$userip=str_replace('*','%',$userip);
					$sql.=" AND (tm.userip LIKE '$userip') ";
					$ip_add=',tm.userip';
				}

				$rs=$db->get_one("SELECT COUNT(*) AS count FROM pw_threads t $sqltable WHERE $sql");
				$count=$rs['count'];
				if(!is_numeric($lines))$lines=100;
				if (!is_numeric($page)) $page=1;
				$numofpage=ceil($count/$lines);
				if($numofpage&&$page>$numofpage){
					$page=$numofpage;
				}
				$fenye=numofpage($count,$page,$numofpage,"admin.php?adminjob=superdel&a_type=article&action=$action&fid=$fid&ifkeep=$ifkeep&postdate=$postdate&lastpost=$lastpost&hits=$hits&replies=$replies&author=".rawurlencode($author)."&keyword=".rawurlencode($keyword)."&lines=$lines&");
				$start=($page-1)*$lines;
				$limit="LIMIT $start,$lines";

				$topicdb=array();
				include R_P.'data/bbscache/forum_cache.php';
				$query=$db->query("SELECT t.* $ip_add FROM pw_threads t $sqltable WHERE $sql $limit");
				while($topic=$db->fetch_array($query)){
					if($_POST['direct']){
						$delid[$topic['tid']]=$topic['fid'];
					} else{
						$topic['forumname'] = $forum[$topic['fid']]['name'];
						$topic['postdate'] = get_date($topic['postdate']);
						$topic['lastpost'] = get_date($topic['lastpost']);
						$topicdb[]=$topic;
					}
				}
				if(!$_POST['direct']){
					include PrintEot('superdel');exit;
				}
			}
		}
		if($_POST['step']==2 || $_POST['direct']){
			!$delid && adminmsg('operate_error');
			$delids='';$fidarray=array();
			foreach($delid as $key=>$value){
				is_numeric($key) && $delids.=$key.',';
				if(!in_array($value,$fidarray)){
					$fidarray[]=$value;
				}
			}
			$delids=substr($delids,0,-1);
			/**
			* 删除帖子
			*/
			$db->update("DELETE FROM pw_threads WHERE tid IN ($delids)");
			$db->update("DELETE FROM pw_posts   WHERE tid IN ($delids)");
			$db->update("DELETE FROM pw_tmsgs   WHERE tid IN ($delids)");
			/**
			* 数据更新
			*/
			foreach($fidarray as $fid){
				updateforum($fid);
			}
			@unlink(R_P.'data/bbscache/c_cache.php');
			adminmsg('operate_success');
		}
	} elseif($action=='delrpl'){
		if(empty($_POST['step'])){
			if(!$counts && !$tcounts && $fid=='-1' && !$keyword && !$tid && !$author && !$userip){
				adminmsg('noenough_condition');
			}
			if(!is_numeric($nums) || !$nums){
				$nums=1000;
			}
			if($fid=='-1'){
				$sql="fid IN($allowfid)";
			} elseif(is_numeric($fid)){
				if(strpos($allowfid,$fid)===false){
					adminmsg('forum_right');
				} else{
					$sql="fid='$fid'";
				}
			} else{
				adminmsg('forumid_error');
			}
			$tids='';
			if($tid){
				$tid_array=explode(",",$tid);
				foreach($tid_array as $value){
					if(is_numeric($value)){
						$tids.=$value.',';
					}
				}
				$tids=substr($tids,0,-1);
				$tids && $sql.=" AND tid IN($tids)";
			}
			if($author){
				$authorarray=explode(",",$author);
				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);
				foreach($keywordarray as $value){
					$value=str_replace('*','%',$value);
					$keywhere.=" OR content LIKE '%$value%' ";
				}
				$keywhere=substr_replace($keywhere,"",0,3);
				$sql.=" AND ($keywhere) ";	
			}
			if($userip){
				$userip=str_replace('*','%',$userip);
				$sql.=" AND (userip LIKE '$userip') ";
			}

			if($tcounts){
				$sql.=" AND char_length(content)>".(int)$tcounts;
			}elseif($counts){
				$sql.=" AND char_length(content)<".(int)$counts;
			}
			$nums && $sql.="  LIMIT $nums";
			include R_P.'data/bbscache/forum_cache.php';
			$query=$db->query("SELECT fid,pid,tid,author,authorid,content,postdate,userip FROM pw_posts WHERE $sql");
			while($post=$db->fetch_array($query)){
				if($_POST['direct']){
					$delid[$post['pid']]=$post['fid'].'_'.$post['tid'];
				} else{
					$post['delid']=$post['fid'].'_'.$post['tid'];
					$post['forumname'] = $forum[$post['fid']]['name'];
					$post['postdate'] = get_date($post['postdate']);
					$post['content']=substrs($post['content'],30);
					$postdb[]=$post;
				}
			}
			if(!$_POST['direct']){
				include PrintEot('superdel');exit;
			}
		}
		if($_POST['step']==2 || $_POST['direct']){
			!$delid && adminmsg('operate_error');
			$delids='';$fidarray=$tidarray=array();
			foreach($delid as $key=>$value){
				is_numeric($key) && $delids.=$key.',';
				list($dfid,$dtid)=explode('_',$value);
				$tidarray[]=$dtid;
				if(!in_array($value,$fidarray)){
					$fidarray[]=$dfid;
				}
			}
			$delids=substr($delids,0,-1);
			/**
			* 删除帖子
			*/
			$db->update("DELETE FROM pw_posts WHERE pid IN ($delids)");
			

			$tidarray=array_count_values($tidarray);
			foreach($tidarray as $key=>$value){
				$db->update("UPDATE pw_threads SET replies=replies-'$value' WHERE tid='$key'");
			}
			/**
			* 数据更新
			*/
			foreach($fidarray as $fid){
				updateforum($fid);
			}
			@unlink(R_P.'data/bbscache/c_cache.php');
			adminmsg('operate_success');
		}
	}
} elseif($a_type=='member'){
	$basename="admin.php?adminjob=superdel&a_type=member";
	require_once GetLang('all');
	if(empty($action)){
		$groupselect="<option value='-1'>$lang[reg_member]</option>";
		$query=$db->query("SELECT gid,gptype,grouptitle FROM pw_usergroups WHERE gptype<>'member' AND gptype<>'default' ORDER BY gid");
		while($group=$db->fetch_array($query)){
			$groupselect.="<option value=$group[gid]>$group[grouptitle]</option>";
		}
		include PrintEot('superdel');exit;
	} elseif($action=='del'){
		if(empty($_POST['step'])){
			if(!$schname && !$schemail && !$groupid && $regdate=='all' && $schlastvisit='all'){
				adminmsg('noenough_condition');
			} else{
				if($groupid!='-1'){
					$sql="m.groupid='$groupid' ";
				} else{
					$sql='1 ';
				}
				if($schname!=''){
					$schname=addslashes(str_replace('*','%',$schname));
					$sql.=" AND (m.username LIKE '%$schname%')";
				}
				if($schemail!=''){
					$schemail=str_replace('*','%',$schemail);
					$sql.=" AND (m.email LIKE '%$schemail%')";
				}
				if($postnum){
					$sql.=" AND md.postnum<'$postnum'";
				}
				if($onlinetime){
					$sql.=" AND md.onlinetime<'$onlinetime'";
				}
				if($regdate!='all'){
					$schtime=$timestamp-$regdate;
					$sql.=" AND m.regdate<'$schtime'";
				}
				if($schlastvisit!='all'){
					$schtime=$timestamp-$schlastvisit;
					$sql.=" AND md.thisvisit<'$schtime'";
				}
				if($orderway){
					$order=" ORDER BY $orderway ";
					 $asc && $order.=$asc;
				}
				
				$rs=$db->get_one("SELECT COUNT(*) AS count FROM pw_members m LEFT JOIN pw_memberdata md ON md.uid=m.uid WHERE $sql");
				$count=$rs['count'];
				if(!is_numeric($lines))$lines=100;
				if (!is_numeric($page)) $page=1;
				$numofpage=ceil($count/$lines);
				if($numofpage&&$page>$numofpage){
					$page=$numofpage;
				}
				$fenye=numofpage($count,$page,$numofpage,"admin.php?adminjob=superdel&a_type=member&action=$action&groupid=$groupid&schname=".rawurlencode($schname)."&schemail=$schemail&postnum=$postnum&onlinetime=$onlinetime&regdate=$regdate&schlastvisit=$schlastvisit&orderway=$orderway&asc=$asc&lines=$lines&");
				$start=($page-1)*$lines;
				$limit="LIMIT $start,$lines";
				$query=$db->query("SELECT m.uid,m.username,m.email,m.groupid,m.regdate,md.thisvisit,md.postnum,md.onlineip FROM pw_members m LEFT JOIN pw_memberdata md ON md.uid=m.uid WHERE $sql $order $limit");
				while($sch=$db->fetch_array($query)){
					if($_POST['direct']){
						$delid[]=$sch['uid'];
					} else{
						strpos($sch['onlineip'],'|') && $sch['onlineip']=substr($sch['onlineip'],0,strpos($sch['onlineip'],'|'));
						if($sch['groupid']=='-1'){
							$sch['group']=$lang['reg_member'];
						} else{
							$sch['group']=$ltitle[$sch['groupid']];
						}
						$sch['regdate']= get_date($sch['regdate']);
						$sch['thisvisit']= get_date($sch['thisvisit']);
						$schdb[]=$sch;
					}
				}
				if(!$_POST['direct']){
					include PrintEot('superdel');exit;
				}
			}
		}
		if($_POST['step']==2 || $_POST['direct']){
			!$delid && adminmsg('operate_error');
			$delids='';
			foreach($delid as $value){
				$member=$db->get_one("SELECT m.username,m.groupid,m.regdate,md.postnum FROM pw_members m LEFT JOIN pw_memberdata md ON md.uid=m.uid WHERE m.uid='$value'");
				if($member['username']==$manager)adminmsg('manager_right');
				if($member['groupid']==3 && $admin_name!=$manager)adminmsg('manager_right');
				if($member['groupid']==6){
					$db->update("DELETE FROM pw_banuser WHERE uid='$value'");
				}
				$newuser_log.="<?die;?>|$member[username]|$member[groupid]|$member[postnum]|$member[regdate]|$admin_name\n";
				is_numeric($value) && $delids.=$value.',';
			}
			writeover(R_P."data/bbscache/user_log.php",$newuser_log,"ab");
			$delids=substr($delids,0,-1);
			$db->update("DELETE FROM pw_members WHERE uid IN ($delids)");
			$db->update("DELETE FROM pw_memberdata WHERE uid IN ($delids)");
			$db->update("DELETE FROM pw_memberinfo WHERE uid IN ($delids)");

			@extract($db->get_one("SELECT count(*) AS count FROM pw_members"));
			@extract($db->get_one("SELECT username FROM pw_members ORDER BY regdate DESC LIMIT 1"));
			$db->update("UPDATE pw_bbsinfo SET newmember='$username', totalmember='$count'  WHERE id='1'");
			adminmsg('operate_success');
		}
	}
} elseif($a_type=='message'){
	$basename="admin.php?adminjob=superdel&a_type=message";
	if(empty($action)){
		$basename="admin.php?adminjob=superdel&a_type=message";
		include PrintEot('superdel');exit;
	} elseif($action=='del'){
		if(empty($_POST['step'])){
			if(!$type && !$keepnew && !$username && !$msgdate){
				adminmsg('noenough_condition');
			} else{
				if($type!='all'){
					$sql="type='$type'";
				} else{
					$sql='1 ';
				}
				if($keepnew){
					$sql.=" AND ifnew='0'";
				}
				if($msgdate){
					$sql.=" ";
				}
				if($username){
					$userarray=explode(",",$username);
					foreach($userarray as $value){
						$value=str_replace('*','%',$value);
						$value=addslashes($value);
						$rs=$db->get_one("SELECT uid FROM pw_members WHERE username LIKE '%$value%'");
						if($type=='rebox'){
							$userwhere.=" OR (touid='$rs[uid]')";
						} elseif($type=='sebox'){
							$userwhere.=" OR (fromuid='$rs[uid]')";
						} else{
							$userwhere.=" OR (fromuid='$rs[uid]' AND type='sebox' OR touid='$rs[uid]' AND type='rebox')";
						}
					}
					$userwhere=substr_replace($userwhere,"",0,3);
					$sql.=" AND ($userwhere)";
				}
				if($msgdate){
					$schtime=$timestamp-$msgdate*24*3600;
					$sql.=" AND mdate<'$schtime'";
				}

				$rs=$db->get_one("SELECT COUNT(*) AS count FROM pw_msg WHERE $sql");
				$count=$rs['count'];
				if(!is_numeric($lines))$lines=100;
				if (!is_numeric($page)) $page=1;
				$numofpage=ceil($count/$lines);
				if($numofpage&&$page>$numofpage){
					$page=$numofpage;
				}
				$fenye=numofpage($count,$page,$numofpage,"admin.php?adminjob=superdel&a_type=message&action=$action&type=$type&keepnew=$keepnew&msgdate=$msgdate&username=".rawurlencode($username)."&lines=$lines&");
				$start=($page-1)*$lines;
				$limit="LIMIT $start,$lines";
				$query=$db->query("SELECT * FROM pw_msg WHERE $sql $limit");
				while($message=$db->fetch_array($query)){
					if($_POST['direct']){
						$delid[]=$message['mid'];
					} else{
						$message['date']=get_date($message['mdate']);
						$messagedb[]=$message;
					}
				}
				if(!$_POST['direct']){
					include PrintEot('superdel');exit;
				}
			}
		}
		if($_POST['step']==2 || $_POST['direct']){
			!$delid && adminmsg('operate_error');
			foreach($delid as $value){
				is_numeric($value) && $delids.=$value.',';
			}
			$delids=substr($delids,0,-1);
			$db->update("DELETE FROM pw_msg WHERE mid IN ($delids)");
			adminmsg('operate_success');
		}
	}
}
?>

⌨️ 快捷键说明

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