Home > Backend Development > PHP Tutorial > 导入用户到Discuz论坛

导入用户到Discuz论坛

PHP中文网
Release: 2016-06-13 11:26:16
Original
1042 people have browsed it

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)
Copy after login


Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template