Home > Article > Backend Development > Discuz 6.0+ batch registration of usernames_PHP tutorial
1. Copy adduser.php to the discuz root directory;
/--adduser.php content is as follows--/
php
require_once './include/common.inc.php ';
//Registered name
$user_list = file('./username.txt ');
//Registered password
$a = "12345678";
$pwd = md5 ($a);
//Number of registered users (it is recommended to be less than 10,000)
$member_num = count($user_list);
//Set the running time
set_time_limit(3600);
for($i=0;$i<$member_num;$i++) {
$username = $user_list[$i];
$db->query("REPLACE INTO {$tablepre}members ( username, password,regdate) VALUES ('$username', '$pwd','1175655041')");
$uid = $db->insert_id();
$db->query( "INSERT INTO {$tablepre}memberfields (uid) VALUES ('$uid')");
echo $i.':'.$username."__Complete
";
?>
2. Manually collect the username and put it in the discuz root directory
/--username.txt content is as follows--/
mouse365
Big Rookie
SHAM
Just make sure there’s one per line!
PS: The following method can be used to collect user names (take http://www.freediscuz.net/bbs/member.php?action=list as an example)
1. Open the URL http://www .freediscuz.net/bbs/member.php?action=list;
2. Copy the following information and save it to username.txt
admin 1 2003-6-7 2008-12-22 15:06 127 421
theoldmemory 3 2003-6-8 2004-8-8 23:15 0 0
lauraych 4 2003-6-9 2007-9-28 16:36 0 0
3. Use editors such as UltraEdit to execute regular rules Match and remove useless information
admin
theoldmemory
lauraych