迁移drupal用户到discuz7(ucenter)

extjs.org.cn是用drupal来做论坛的,真他妈的不好用了. 被逼无耐,只好安装了个现在国内最多人使用,功能强大的discuz7.现在问题来了,以前的注册用户你总不能让用户再注册一次吧?没有办法,只能把原来drupal上的所有注册用户都迁移到discuz7上.

由于我的论坛跟drupal在同一个服务器,只是在不同的数据库服务器上,操作办法非常简单.只需一条sql语言即可搞定.

在导入用户之前你必须了解discuz7(ucenter)用户的加密算法.

discuz7(ucenter)用户的加密算法: md5密码后,再加上一个随机6位数,再md5一次.如下sql

1
SELECT md5(concat(md5('mypassword'),'extjs.')) AS pass

‘mypassword’ 为用户密码,’extjs.’为随机的6位数(其实不一定要随机,只要6位就可以了).

完整的迁移用户名密码的sql如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
INSERT INTO discuz7.cdb_uc_members 
	( 
	username, 
	password, 
	email, 
	myid, 
	myidkey, 
	regip, 
	regdate, 
	lastloginip, 
	lastlogintime, 
	salt, 
	secques
	)
SELECT name,md5(concat(pass,'extjs.')) AS pass
	,mail,'','','hidden',created,0,0,'extjs.',''
FROM drupal.users WHERE name != 'fatjames' AND name!= 'extjs.org.cn'
This entry was posted in DataBase, 网站应用 and tagged , , , . Bookmark the permalink.

3 Responses to 迁移drupal用户到discuz7(ucenter)

  1. horseluke says:

    无限膜拜中………….

  2. horseluke says:

    但,插入的语句一般不是INSERT INTO … VALUES …的吗?为什么可以省略VALUE的?

  3. admin says:

    @horseluke
    这个是表数据时常用的方法,

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word