View Single Post
  #1   IP: 218.2.39.80
Old 2007-02-23, 11:47 AM
car car is offline
高级会员
 
Join Date: 2006-05-14
Posts: 534
car 正向着好的方向发展
Default 一个小工具:让以前注册的用户在论坛也显示进入空间

如果遇到下面的问题,怎么解决:
原先注册博客的用户,在论坛中提示"申请个人空间",点申请却提示已经注册了。怎么才能让以前注册的用户也显示进入空间呢?
Quote:
<?

$perpage = 100;
$thefile = 'up.php';

$stablepre = 'supe_';
$tablepre = 'cdb_';

require_once('./config.inc.php');

if(empty($_GET['page'])) $_GET['page'] = 1;
$page = intval($_GET['page']);
if($page<1) $page = 1;
$start = ($page - 1) * $perpage;

mysql_connect($dbhost, $dbuser, $dbpw);
mysql_select_db($dbname);

$query = mysql_query("SELECT COUNT(*) FROM {$stablepre}userspaces");
$listcount = mysql_result($query, 0);

echo '会员总数:'.$listcount.'<br>';

if($listcount && $start <= $listcount) {
$uidarr = array();
$query = mysql_query("SELECT uid FROM {$stablepre}userspaces LIMIT $start, $perpage");
while ($member = mysql_fetch_array($query)) {
$uidarr[] = $member['uid'];
}
if(!empty($uidarr)) {
echo "处理UID: ".implode(',', $uidarr)."<br>";
mysql_query("UPDATE {$tablepre}members SET xspacestatus=1 WHERE uid IN (".implode(',', $uidarr).")");
}
} else {
echo '处理完成,请立即删除本文件 '.$thefile;
exit;
}

echo '<meta http-equiv="refresh" content="5;url='.$thefile.'?page='.($page+1).'">';
echo '稍等,处理中...';

?>
将以上代码存为 up.php,并放到 论坛目录下面,在浏览器中执行,就可以了。执行完毕后,请记得删除。
Reply With Quote