标题:
[
Discuz!相关
]
将UC的用户导入到DZ7.2
[打印本页]
作者:
shillan
时间:
2013-7-20 14:18
标题:
将UC的用户导入到DZ7.2
<?php
$dbserver ='localhost'; //此处改成数据库服务器地址
$dbuser ='admin';//此处写数据库用户名
$dbpwd ='admin';//数据库密码
$dbname ='db';//数据库名称
global $connect;
$connect=mysql_connect($dbserver,$dbuser,$dbpwd) or die("无法连接数据库");
@mysql_select_db($dbname,$connect);
mysql_query('set names gbk');//此处依据自己站点的字符集设置
//从此行向下,默认UC的表前缀是uc_,dz7.2的表前缀是cdb_,实际使用的时候要自己修改
$query = mysql_query("SELECT * FROM uc_members WHERE uid not in(select uid from cdb_members) ",$connect);
while($user = mysql_fetch_array($query)) {
echo $password=$user['username']; //此处查看有多少用户得转
echo "<br>";
mysql_query(" replace INTO cdb_members (uid,username,password,adminid,groupid,regdate,email) VALUES ('$user[uid]', '$user[username]', '$password','0','10','$user[regdate]','$user[email]') ");
mysql_query(" replace INTO cdb_memberfields (uid,avatarwidth,avatarheight,buyercredit,sellercredit) VALUES ('$user[uid]','0','0','0','0')");
}
echo "Finished successfully!";
?>
复制代码
UC数据表里面的密码密值和DZ的不一样,但是依然能使用。
已测可用。
作者:
光英范格伍
时间:
2014-1-8 13:32
很好!很强大!
欢迎光临 逐梦论坛 (http://temp2023.zhumeng.org/)
Powered by Discuz! 7.2