首页 > 后端开发 > php教程 > 导入用户到Discuz论坛

导入用户到Discuz论坛

PHP中文网
发布: 2016-06-13 11:26:16
原创
1036 人浏览过

import torndb
 
db_info1 = dict(
    host = "127.0.0.1:3306",
    data = "data_test",
    user = "root",
    password = "password")
 
db_info2 = dict(
    host = "127.0.0.1:3306",
    data = "dz_bbs",
    user = "root",
    password = "password.c0m")
 
db1 = torndb.Connection(
            host = db_info1.get('host'),
            database = db_info1.get('data'),
            user = db_info1.get('user'),
            password = db_info1.get('password')
            )
 
db2 = torndb.Connection(
            host = db_info2.get('host'),
            database = db_info2.get('data'),
            user = db_info2.get('user'),
            password = db_info2.get('password')
            )
 
sql = "select username, password from temp_users order by id;"
ret = db1.query(sql)
 
salt = '123645'
 
for item in ret:
    username = item.get('username')
    password = item.get('password')
    sql = "insert into pre_ucenter_members (username,password,salt) values('%s', md5(concat(md5('%s'),'%s')),'%s');" % (username, password, salt, salt)
    db2.execute(sql)
登录后复制


相关标签:
php
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
作者最新文章
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板