www.gusucode.com > ShopEx481 & PHPWind 整合版码程序 > bbs/admin/superdel.php
<?php !function_exists('adminmsg') && exit('Forbidden'); require_once(R_P.'require/forum.php'); if ($a_type == 'article') { require_once(R_P.'require/updateforum.php'); $basename = "$admin_file?adminjob=superdel&a_type=article"; if ($admin_gid == 5) { list($allowfid,$forumcache) = GetAllowForum($admin_name); $sql = "fid IN($allowfid)"; } else { include(D_P.'data/bbscache/forumcache.php'); list($hidefid,$hideforum) = GetHiddenForum(); if ($admin_gid == 3) { $forumcache .= $hideforum; $sql = '1'; } else { $sql = "fid NOT IN($hidefid)"; } } if (empty($action)) { $p_table = $t_table = ''; if ($db_plist) { $p_table = "<option value=\"0\">pw_posts</option>"; $p_list = explode(',',$db_plist); foreach ($p_list as $key=>$val) { $p_table .= "<option value=\"$val\">pw_posts$val</option>"; } $p_table = str_replace("<option value=\"$db_ptable\">","<option value=\"$db_ptable\" selected>",$p_table); } if ($db_tlist) { $tlistdb = unserialize($db_tlist); asort($tlistdb); $t_table = "<option value=\"\">pw_tmsgs</option>"; foreach ($tlistdb as $key=>$val) { $t_table .= "<option value=\"$key\">pw_tmsgs$key</option>"; } } include PrintEot('superdel');exit; } elseif ($action == 'deltpc') { InitGP(array('ttable')); if ($ttable == 'auto') { $rt = $db->get_one("SELECT MAX(tid) AS mtid FROM pw_threads"); $pw_tmsgs = GetTtable($rt['mtid']); } else { $pw_tmsgs = $ttable>0 ? 'pw_tmsgs'.$ttable : 'pw_tmsgs'; } if (empty($_POST['step'])) { InitGP(array('fid','ifkeep','pstarttime','pendtime','lstarttime','lendtime','tstart','tend','hits','replies','author','keyword','tcounts','counts','userip','lines','page')); $_POST['pstarttime'] && $pstarttime = PwStrtoTime($pstarttime); $_POST['pendtime'] && $pendtime = PwStrtoTime($pendtime); $_POST['lstarttime'] && $lstarttime = PwStrtoTime($lstarttime); $_POST['lendtime'] && $lendtime = PwStrtoTime($lendtime); $tstart = (int)$tstart; $tend = (int)$tend; if ($fid=='-1' && !$pstarttime && !$pendtime && !$tcounts && !$counts && !$lstarttime && !$lendtime && !$hits && !$replies && !$author && !$keyword && !$userip && !$tstart && !$tend) { adminmsg('noenough_condition'); } if (is_numeric($fid) && $fid > 0) { $sql .= " AND t.fid='$fid'"; } if ($ifkeep) { $sql.=" AND t.topped=0 AND t.digest=0"; } if ($pstarttime) { $sql.=" AND t.postdate>'$pstarttime'"; } if ($pendtime) { $sql.=" AND t.postdate<'$pendtime'"; } if ($lstarttime) { $sql.=" AND t.lastpost>'$lstarttime'"; } if ($lendtime) { $sql.=" AND t.lastpost<'$lendtime'"; } if ($tstart) { $sql.=" AND t.tid>'$tstart'"; } if ($tend) { $sql.=" AND t.tid<'$tend'"; } $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 ($author) { $authorarray=explode(",",$author); foreach ($authorarray as $value) { $value=addslashes(str_replace('*','%',$value)); $authorwhere.=" OR username LIKE '$value'"; } $authorwhere=substr_replace($authorwhere,"",0,3); $authorids='-99'; $query=$db->query("SELECT uid FROM pw_members WHERE $authorwhere"); while ($rt=$db->fetch_array($query)) { $authorids .= ','.$rt['uid']; } $sql.=" AND t.authorid IN($authorids)"; } if ($keyword) { $keyword=trim($keyword); $keywordarray=explode(",",$keyword); foreach ($keywordarray as $value) { $value=str_replace('*','%',$value); $keywhere.='OR'; $keywhere.=" tm.content LIKE '%$value%' OR t.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'; } $sql .= " AND tm.tid!=''"; $rs = $db->get_one("SELECT COUNT(*) AS count FROM pw_threads t LEFT JOIN $pw_tmsgs tm ON tm.tid=t.tid WHERE $sql"); $count=$rs['count']; if (!is_numeric($lines))$lines=100; (!is_numeric($page) || $page < 1) && $page=1; $numofpage=ceil($count/$lines); if ($numofpage && $page>$numofpage) { $page=$numofpage; } $pages=numofpage($count,$page,$numofpage,"$admin_file?adminjob=superdel&a_type=article&action=$action&fid=$fid&ifkeep=$ifkeep&pstarttime=$pstarttime&pendtime=$pendtime&lstarttime=$lstarttime&lendtime=$lendtime&tstart=$tstart&tend=$tend&hits=$hits&replies=$replies&author=".rawurlencode($author)."&keyword=".rawurlencode($keyword)."&userip=$userip&lines=$lines&ttable=$ttable&"); $start = ($page-1)*$lines; $limit = "LIMIT $start,$lines"; $delid = $topicdb = array(); include(D_P.'data/bbscache/forum_cache.php'); $query = $db->query("SELECT t.*,tm.userip FROM pw_threads t LEFT JOIN $pw_tmsgs tm ON tm.tid=t.tid 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']) { if (!$_POST['direct']) { InitGP(array('delid'),'P'); } !$delid && adminmsg('operate_error'); $delids = $delaids = $pollids = $actids = $rewids = ''; $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_guestread && require_once(R_P.'require/guestfunc.php'); $ptable_a = array(); $query = $db->query("SELECT t.tid,t.fid,t.replies,t.postdate,t.special,t.ptable,tm.aid,t.ifupload FROM pw_threads t LEFT JOIN $pw_tmsgs tm ON tm.tid=t.tid WHERE $sql AND t.tid IN($delids)"); while (@extract($db->fetch_array($query))) { $ptable_a[$ptable]=1; if ($aid) { $attachs = unserialize(stripslashes($aid)); foreach ($attachs as $key=>$value) { is_numeric($key) && $delaids.=$key.','; P_unlink("$attachdir/$value[attachurl]"); $value['ifthumb'] && P_unlink("$attachdir/thumb/$value[attachurl]"); } } switch ($special) { case 1: $pollids .= $tid.',';break; case 2: $actids .= $tid.',';break; case 3: $rewids .= $tid.',';break; } if ($ifupload) { $pw_posts = GetPtable($ptable); $query2=$db->query("SELECT aid FROM $pw_posts WHERE tid='$tid'"); while (@extract($db->fetch_array($query2))) { if ($aid) { $attachs= unserialize(stripslashes($aid)); foreach ($attachs as $key=>$value) { is_numeric($key) && $delaids.=$key.','; P_unlink("$attachdir/$value[attachurl]"); $value['ifthumb'] && P_unlink("$attachdir/thumb/$value[attachurl]"); } } } } $htmurl=$db_htmdir.'/'.$fid.'/'.date('ym',$postdate).'/'.$tid.'.html'; if (file_exists(R_P.$htmurl)) { P_unlink(R_P.$htmurl); } $db_guestread && clearguestcache($tid,$replies); } if ($pollids) { $pollids=substr($pollids,0,-1); $db->update("DELETE FROM pw_polls WHERE tid IN($pollids)"); } if ($actids) { $actids = substr($actids,0,-1); $db->update("DELETE FROM pw_activity WHERE tid IN($actids)"); $db->update("DELETE FROM pw_actmember WHERE actid IN($actids)"); } if ($rewids) { $rewids = substr($rewids,0,-1); $db->update("DELETE FROM pw_reward WHERE tid IN($rewids)"); } if ($delaids) { $delaids=substr($delaids,0,-1); $db->update("DELETE FROM pw_attachs WHERE aid IN($delaids)"); } $db->update("DELETE FROM pw_threads WHERE tid IN ($delids)"); foreach ($ptable_a as $key=>$val) { $pw_posts = GetPtable($key); $db->update("DELETE FROM $pw_posts WHERE tid IN ($delids)"); } $db->update("DELETE FROM $pw_tmsgs WHERE tid IN ($delids)"); delete_tag($delids); /** * 数据更新 */ foreach ($fidarray as $fid) { updateforum($fid); } P_unlink(D_P.'data/bbscache/c_cache.php'); adminmsg('operate_success'); } } elseif ($action == 'delrpl') { InitGP(array('ptable')); is_numeric($ptable) && $db_ptable = $ptable; $pw_posts = GetPtable($db_ptable); if (empty($_POST['step'])) { InitGP(array('fid','tid','pstart','pend','author','keyword','tcounts','counts','userip','nums','page')); $pstart = (int)$pstart; $pend = (int)$pend; if (!$counts && !$tcounts && $fid=='-1' && !$keyword && !$tid && !$author && !$userip && !$pstart && !$pend) { adminmsg('noenough_condition'); } if (is_numeric($fid) && $fid > 0) { $sql .= " AND fid='$fid'"; } if ($tid) { $tids = 0; $tid_array = explode(",",$tid); foreach ($tid_array as $value) { if (is_numeric($value)) { $tids.=','.$value; } } $tids && $sql.=" AND tid IN($tids)"; } if ($pstart) { $sql.=" AND pid>'$pstart'"; } if ($pend) { $sql.=" AND pid<'$pend'"; } if ($author) { $authorarray=explode(",",$author); foreach ($authorarray as $value) { $value=addslashes(str_replace('*','%',$value)); $authorwhere.=" OR username LIKE '$value'"; } $authorwhere=substr_replace($authorwhere,"",0,3); $authorids='-99'; $query=$db->query("SELECT uid FROM pw_members WHERE $authorwhere"); while ($rt=$db->fetch_array($query)) { $authorids .= ','.$rt['uid']; } $sql.=" AND authorid IN($authorids)"; } 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 = is_numeric($nums) ? $nums : 20; (!is_numeric($page) || $page < 1) && $page = 1; $limit = " LIMIT ".($page-1)*$nums.",$nums"; $rt = $db->get_one("SELECT COUNT(*) AS sum FROM $pw_posts WHERE $sql"); $pages = numofpage($rt['sum'],$page,ceil($rt['sum']/$nums),"$admin_file?adminjob=superdel&a_type=article&action=$action&fid=$fid&tid=$tid&pstart=$pstart&pend=$pend&author=".rawurlencode($author)."&keyword=".rawurlencode($keyword)."&userip=$userip&tcounts=$tcounts&counts=$counts&nums=$nums&ptable=$ptable&"); $sql .= $_POST['direct'] ? " LIMIT $nums" : $limit; $delid = $postdb = array(); $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']) { if (!$_POST['direct']) { InitGP(array('delid'),'P'); } !$delid && adminmsg('operate_error'); $delids = $dtids = ''; $fidarray = $tidarray = array(); foreach ($delid as $key=>$value) { is_numeric($key) && $delids.=$key.','; list($dfid,$dtid)=explode('_',$value); $tidarray[]=$dtid; $dtids.=$dtid.','; if (!in_array($dfid,$fidarray)) { $fidarray[]=$dfid; } } $delids = substr($delids,0,-1); $dtids = substr($dtids,0,-1); /** * 删除帖子 */ $query=$db->query("SELECT tid,fid,postdate,ifupload FROM pw_threads WHERE tid IN($dtids)"); while (@extract($db->fetch_array($query))) { $htmurl = $db_htmdir.'/'.$fid.'/'.date('ym',$postdate).'/'.$tid.'.html'; if (file_exists(R_P.$htmurl)) { P_unlink(R_P.$htmurl); } } $query = $db->query("SELECT aid FROM $pw_posts WHERE pid IN ($delids)"); while (@extract($db->fetch_array($query))) { if ($aid) { $attachs = unserialize(stripslashes($aid)); foreach ($attachs as $key=>$value) { is_numeric($key) && $delaids.=$key.','; P_unlink("$attachdir/$value[attachurl]"); $value['ifthumb'] && P_unlink("$attachdir/thumb/$value[attachurl]"); } } } if ($delaids) { $delaids = substr($delaids,0,-1); $db->update("DELETE FROM pw_attachs WHERE aid IN($delaids)"); } $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); } P_unlink(D_P.'data/bbscache/c_cache.php'); adminmsg('operate_success'); } } elseif ($action == 'view') { InitGP(array('tid','pid')); $pw_posts = GetPtable('N',$tid); $rt = $db->get_one("SELECT COUNT(*) AS sum FROM $pw_posts WHERE tid='$tid' AND pid<'$pid'"); $page = ceil(($rt['sum']+1.5)/$db_readperpage); ObHeader("read.php?tid=$tid&page=$page#$pid"); } } elseif ($a_type == 'member') { $basename="$admin_file?adminjob=superdel&a_type=member"; require_once(R_P.'require/writelog.php'); 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'])) { InitGP(array('groupid','schname','schemail','postnum','onlinetime','userip','regdate','schlastvisit','orderway','asc','lines','page')); if (!$schname && !$schemail && !$groupid && $regdate=='all' && $schlastvisit='all') { adminmsg('noenough_condition'); } if ($groupid != '-1') { if ($groupid=='3' && !If_manager) { adminmsg('manager_right'); } elseif (($groupid=='4' || $groupid=='5') && $admin_gid != 3) { adminmsg('admin_right'); } $sql="m.groupid='$groupid'"; } else { $sql="m.groupid='-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 ($userip) { $userip=str_replace('*','%',$userip); $sql.=" AND (md.onlineip LIKE '$userip%') "; } if ($regdate!='all') { $schtime=$timestamp-$regdate; $sql.=" AND m.regdate<'$schtime'"; } if ($schlastvisit!='all') { $schtime=$timestamp-$schlastvisit; $sql.=" AND md.thisvisit<'$schtime'"; } $order = ''; if ($orderway) { !in_array($orderway,array('regdate','lastvisit','postnum')) && $orderway='uid'; $order=" ORDER BY ".($orderway=='regdate' ? "m.uid " : "md.$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; (!is_numeric($page) || $page < 1) && $page=1; $numofpage = ceil($count/$lines); if ($numofpage && $page>$numofpage) { $page = $numofpage; } $pages=numofpage($count,$page,$numofpage,"$admin_file?adminjob=superdel&a_type=member&action=$action&groupid=$groupid&schname=".rawurlencode($schname)."&schemail=$schemail&postnum=$postnum&onlinetime=$onlinetime®date=$regdate&schlastvisit=$schlastvisit&orderway=$orderway&asc=$asc&lines=$lines&"); $start = ($page-1)*$lines; $limit = "LIMIT $start,$lines"; $delid = $schdb = array(); $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']) { InitGP(array('delid'),'P'); !$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'"); Add_S($member); if (CkInArray($member['username'],$manager))adminmsg('manager_right'); if ($member['groupid']==3 && !If_manager)adminmsg('manager_right'); if ($member['groupid']==6) { $db->update("DELETE FROM pw_banuser WHERE uid='$value'"); } is_numeric($value) && $delids.=$value.','; $log = array( 'type' => 'deluser', 'username1' => $member['username'], 'username2' => $admin_name, 'field1' => $fid, 'field2' => $member['groupid'], 'field3' => '', 'descrip' => 'deluser_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, ); writelog($log); } $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 uid 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_file?adminjob=superdel&a_type=message"; if (empty($action)) { include PrintEot('superdel');exit; } elseif ($action == 'del') { if (empty($_POST['step'])) { InitGP(array('keepnew','fromuser','touser','msgdate','keyword','lines','page')); if (!$type && !$keepnew && !$fromuser && !$touser && !$msgdate) { adminmsg('noenough_condition'); } if ($type!='all') { $sql = "m.type='$type'"; } else { $sql = '1 '; } if ($keepnew) { $sql .= " AND m.ifnew='0'"; } $mc_tab = ''; if ($keyword) { $keyword = trim($keyword); $keywordarray = explode(",",$keyword); foreach ($keywordarray as $value) { $value = str_replace('*','%',$value); $keywhere .= 'OR'; $keywhere .= " mc.content LIKE '%$value%' OR mc.title LIKE '%$value%' "; } $keywhere = substr_replace($keywhere,"",0,3); $sql .= " AND ($keywhere) "; $mc_tab = ' LEFT JOIN pw_msgc mc ON m.mid=mc.mid'; } if ($fromuser) { if ($fromuser == 'SYSTEM') { $sql .= " AND fromuid='0'"; } else { $fromuser = str_replace('*','_',$fromuser); $rt = $db->get_one("SELECT uid,username,groupid FROM pw_members WHERE username LIKE '$fromuser'"); if (!$rt) { $errorname = $fromuser; adminmsg('user_not_exists'); } elseif (CkInArray($rt['username'],$manager) && !If_manager) { adminmsg('msg_managerright'); } elseif ($rt['groupid'] == 3 && $admin_gid != 3) { adminmsg('msg_adminright'); } if ($type == 'rebox' || $type == 'sebox') { $sql .= " AND m.type='$type' AND m.fromuid='$rt[uid]'"; } else { $sql .= " AND m.fromuid='$rt[uid]'"; } } } if ($touser) { $touser = str_replace('*','_',$touser); $rt = $db->get_one("SELECT uid,username,groupid FROM pw_members WHERE username LIKE '$touser'"); if (!$rt) { $errorname = $touser; adminmsg('user_not_exists'); } elseif (CkInArray($rt['username'],$manager) && !If_manager) { adminmsg('msg_managerright'); } elseif ($rt['groupid'] == 3 && $admin_gid != 3) { adminmsg('msg_adminright'); } if ($type == 'rebox' || $type=='sebox') { $sql .= " AND m.type='$type' AND m.touid='$rt[uid]'"; } else { $sql .= " AND m.touid='$rt[uid]'"; } } if ($msgdate) { $schtime = $timestamp-$msgdate*24*3600; $sql .= " AND m.mdate<'$schtime'"; } $rs = $db->get_one("SELECT COUNT(*) AS count FROM pw_msg m{$mc_tab} WHERE $sql"); $count = $rs['count']; if (!is_numeric($lines)) $lines = 100; (!is_numeric($page) || $page < 1) && $page = 1; $numofpage = ceil($count/$lines); if ($numofpage && $page>$numofpage) { $page = $numofpage; } $pages=numofpage($count,$page,$numofpage,"$admin_file?adminjob=superdel&a_type=message&action=$action&type=$type&keepnew=$keepnew&msgdate=$msgdate&fromuser=".rawurlencode($fromuser)."&touser=".rawurlencode($touser)."&lines=$lines&"); $start = ($page-1)*$lines; $limit = "LIMIT $start,$lines"; $delid = $messagedb = array(); $query = $db->query("SELECT m.*,mc.title,m1.username as fromuser,m2.username as touser FROM pw_msg m LEFT JOIN pw_msgc mc ON m.mid=mc.mid LEFT JOIN pw_members m1 ON m1.uid=m.fromuid LEFT JOIN pw_members m2 ON m2.uid=m.touid WHERE $sql ORDER BY mid DESC $limit"); while ($message = $db->fetch_array($query)) { if ($_POST['direct']) { $delid[] = $message['mid']; } else { !$message['fromuser'] && $message['fromuser'] = $message['username']; $message['date'] = get_date($message['mdate']); if ($message['type']=='public' && $message['togroups']) { $togroups = explode(',',$message['togroups']); foreach ($togroups as $key=>$gid) { $gid && $message['touser'].=$message['touser'] ? ','.$ltitle[$gid] : $ltitle[$gid]; } } $messagedb[] = $message; } } if (!$_POST['direct']) { include PrintEot('superdel');exit; } } if ($_POST['step']==2 || $_POST['direct']) { if (!$_POST['direct']) { InitGP(array('delid'),'P'); } !$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)"); require_once(R_P.'require/msg.php'); delete_msgc($delids); adminmsg('operate_success'); } } elseif ($action == 'msglog') { $_SERVER['REQUEST_METHOD']!='POST' && PostCheck($verify); InitGP(array('msgdate','lines','delnum')); !$delnum && $delnum = 0; $sql = "1"; if ($msgdate) { $schtime = $timestamp-$msgdate*24*3600; $sql .= " AND mdate<'$schtime'"; } $lines < 1 && $lines = 100; $delids = ''; $query = $db->query("SELECT DISTINCT mid FROM pw_msglog WHERE $sql LIMIT $lines"); while ($rt = $db->fetch_array($query)) { $delids .= ($delids ? ',' : '').$rt['mid']; } require_once(R_P.'require/msg.php'); if ($delids) { $db->update("DELETE FROM pw_msglog WHERE mid IN($delids)"); $delnum += $db->affected_rows(); delete_msgc($delids); adminmsg('msglog_delete_step', EncodeUrl("$basename&action=$action&msgdate=$msgdate&lines=$lines&delnum=$delnum")); } else { delete_msgc(); adminmsg('operate_success'); } } } ?>