PHPWIND[民间论坛]数据搬迁导致丢失严重,用户数据基本全部损坏,十分遗憾来自phpwind.me的远古记忆
删除未发帖回帖会员
把除了发过主题和发过回复的会员,其他会员都删除掉
8.7版本临时处理办法
8.7版本临时处理办法
<?php error_reporting(0); define('P_W',1); define('PW_UPLOAD',1); define('R_P',getdirname(__FILE__)); define('D_P',R_P); require_once(R_P.'require/common.php'); include_once(D_P.'data/bbscache/config.php'); //require_once(R_P.'admin/cache.php'); $basename = 'http://'.$_SERVER['HTTP_HOST'].(isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']); @header("Content-Type:text/html; charset=$db_charset"); include_once(D_P.'data/sql_config.php'); if ($database=='mysqli' && Pwloaddl('mysqli')===false) { $database = 'mysql'; } require_once Pcv(R_P."require/db_$database.php"); $db = new DB($dbhost,$dbuser,$dbpw,$dbname,$PW,$charset,$pconnect); $action = $_GET['action']; $start = $_GET['start']; $s_c = $_GET['s_c']; if(!$action){ $action = 'step1'; } if(!$start){ $start = 0; } if(!$s_c){ $s_c = 0; } $percount = 1500; if ($action == 'step1')//先替换主题内容 { $query = $db->query("SELECT uid FROM pw_members WHERE uid>$start ORDER BY uid LIMIT $percount"); while ($rt = $db->fetch_array($query)) { $lastid = $rt['uid']; //$pw_tmsgs = GetTtable($rt['tid']);//分表尚未处理,一般用不到吧? $check_threads = $db->get_one("SELECT authorid FROM pw_threads WHERE authorid='".$rt['uid']."'"); $check_posts = $db->get_one("SELECT authorid FROM pw_posts WHERE authorid='".$rt['uid']."'"); $check_posts1 = $db->get_one("SELECT authorid FROM pw_posts1 WHERE authorid='".$rt['uid']."'"); $check_posts2 = $db->get_one("SELECT authorid FROM pw_posts2 WHERE authorid='".$rt['uid']."'"); $check_posts3 = $db->get_one("SELECT authorid FROM pw_posts3 WHERE authorid='".$rt['uid']."'"); if(!$check_threads && !$check_posts && !$check_posts1 && !$check_posts2 && !$check_posts3){ //echo "DELETE FROM pw_members WHERE uid='".$rt['uid']."'";exit; $db->update("DELETE FROM pw_members WHERE uid='".$rt['uid']."'"); $db->update("DELETE FROM pw_memberdata WHERE uid='".$rt['uid']."'"); $db->update("DELETE FROM pw_memberinfo WHERE uid='".$rt['uid']."'"); } } $maxid = $db->get_value("SELECT max(uid) FROM pw_members"); echo '当前'.$lastid.'最大 '.$maxid; if($maxid > $lastid){ echo "<meta http-equiv='refresh' content='1;url=$basename?action=$action&start=$lastid&s_c=$s_c'>"; }else{ echo "<meta http-equiv='refresh' content='1;url=$basename?action=posts'>"; } } function getdirname($path=null){ if (!empty($path)) { if (strpos($path,'\\')!==false) { return substr($path,0,strrpos($path,'\\')).'/'; } elseif (strpos($path,'/')!==false) { return substr($path,0,strrpos($path,'/')).'/'; } } return './'; } ?>