本帖最后由 fatppmm 于 2011-10-26 19:56 编辑
因为需要对discuz数据库直接操作,把一些内容说明下
1、如何批量注册
主要是两个数据表,pre_ucenter_members和pre_ucenter_memberfields表格,
Sql语句为:
1)INSERT IGNORE INTO pre_ucenter_members(username, password,email,regdate,salt)
VALUES ('$name', '$pwd','11@126.com','1175655041','$salt');
2)INSERT IGNORE INTO pre_ucenter_memberfields(uid) VALUES ('$uid'),主要,这个uid是前面pre_ucenter_members产生的自增id
2、插入大量用户后,如果用户不激活,该用户的帖子是看不见的,是被锁定的,所以要激活,直接对数据库操作,还有两个表:pre_common_member和pre_common_member_count,sql语句为:
1) INSERT IGNORE INTO pre_common_member(email,username,password,regdate,credits,timeoffset ) VALUES ('11@126.com','$name','$pwd','1175655041','2','$salt'),注意这个密码是无所谓的,系统是读uc的密码的
2)INSERT IGNORE INTO pre_common_member_count(uid,extcredits2) VALUES (".$source1[0]["uid"].",'2'),这个uid就是前面pre_common_member的uid
3、插入大量帖子内容,还是两张表,pre_forum_post和pre_forum_thread,sql语句为:
1)INSERT IGNORE INTO pre_forum_post
SET feed_id = ".$feed['id'].",
fid = '$fid',
tid = ".$source[0]["tid"].",
first = 1,
authorid = $uid,
author = '$username',
subject='".$subject."',
message='".$message."',
dateline=".addslashes($item['date_timestamp']).",
url = '".addslashes($item['link'])."',
htmlon = 1"
2)INSERT IGNORE INTO pre_forum_thread
SET feed_id = ".$feed['id'].",
fid = '$fid',
authorid = $uid,
author = '$username',
lastposter='$username',
subject = '".$subject."',
dateline=".addslashes($item['date_timestamp']).",
lastpost=".addslashes($item['date_timestamp']).",
url = '".addslashes($item['link'])."',
views = 0"
4、要显示板块帖子数和主题数,最后谁发布的,主要是表pre_forum_forum,注意lastpost是4个内容连接成的,中间用\t表示的,sql语句为:
"update pre_forum_forum set threads =threads+1, posts=posts+1,lastpost ='".$subject."' where fid=".$fid
原文来自Myaspx.org技术论文:http://www.myaspx.org/forum.php?mod=viewthread&tid=297&extra=page%3D1 |