逐梦论坛's Archiver

shillan 发表于 2013-7-20 14:18

将UC的用户导入到DZ7.2

[code]<?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!";
?>[/code]UC数据表里面的密码密值和DZ的不一样,但是依然能使用。

已测可用。

光英范格伍 发表于 2014-1-8 13:32

很好!很强大!

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.