PHP merge discuz users, php merge discuz_PHP tutorial

Source: Internet
Author: User
PHP merge discuz users, and php merge discuz. PHP merge discuz users. php merge discuz this article describes how PHP merge discuz user scripts. Share it with you for your reference. Details: A user who needs PHP to merge discuz a few days ago and php to merge discuz

This example describes how to merge discuz user scripts in PHP. Share it with you for your reference. The details are as follows:

A few days ago, I met a project that needs to merge two discuz jobs. one project has a user level of around 0.12 million, and the other is 10 thousand 8. Needless to say, it definitely throws 10 thousand 8, leaving 0.12 million. At first, I felt that it was not easy to handle. Data tables were all associated. I registered a new user and added Records to eight tables. I haven't seen whether other tables have the possibility of modifying records. At that time, I thought that at half past one, I couldn't understand those tables. I searched for them and found the discuz tool. but I can only export less than 0.1 million, so I can only try it myself. later I thought about how to insert a record directly in the key table, other tables may automatically complete the relevant data during user operations, so they try to export the original 10 thousand users, then I wrote a PHP script to directly write the 10 thousand users to the memeber table of the uncenter. The test is OK. Unfortunately, the user points are missing, but the user name and password are retained.

Key steps:

1. export the uncenter member database of the system to be replaced as an SQL file.

2. run the script.

Disclaimer: This script only provides ideas. back up data before using it. data loss is irrelevant to the author. (Simple code, do not spray)

Set_time_limit (0); $ link = mysql_connect ('localhost', 'ngjc', 'ohft6yhhyvt5 ') or die ('could not connect :'. mysql_error (); echo 'connected successfully '; mysql_select_db ('ngjc') or die ('could not select database'); require "SQL. php "; // The exported SQL file $ arrayerr = array (); $ oknum = 0; $ errnum = 0; mysql_query (" SET NAMES utf8 "); foreach ($ sqlarr as $ SQL) {if (! Mysql_query ($ SQL) {$ arrayerr [] = $ SQL; $ errnum ++;} else {$ oknum ++;} echo"
OK:$oknum 
errornum:$errnum
error:
"; print_r($arrayerr); mysql_close($link);

Let's take a look at how to use UC integration.

We have been working on two discuz ucenters and membership systems over the past two days. after my unremitting efforts, we have finally completed integration. after integration, we have implemented the following functions;

The two discuz systems share the same ucenter; // implementation method:

The two discuz systems share the same membership system; // The solution is later;

Integrate ucenter first;

First install a complete discuz system; enter ucenter; add application:

Click install: Continue to the next step

If you click to see the problem, you must solve the problem and install it before you can continue.
Please return to the IP address of the UCenter: if there is no accident, go to the next step.

Ucenter integration is complete. you can log on at the same time and exit at the same time. This is only the first time you need to activate it;

Open config_global.php under the second sub-system config;

In $ _ config ['DB'] ['1'] ['tablepre'] = chuzi _'; add $ _ config ['DB'] ['2'] ['tablepre'] = it _

The second sub-system opens db_driver_mysql.php under the source \ class \ db file;

In row 34th, $ this-> tablepre = $ config ['1'] ['tablepre']; add $ this-> tableprechu = $ config ['2'] ['tablepre'] below;
112nd rows return $ this-> tablepre. $ tablename; change to the following

If (preg_match ("/^ common_member (. *)/I ", $ tablename) | preg_match ("/^ home (. *)/I ", $ tablename) | in_array ($ tablename, array ('Common _ credit_rule_log ') {return $ this-> tableprechu. $ tablename; // tableprechu corresponds to the above modification;} else {return $ this-> tablepre. $ tablename ;}

The above are two ways to integrate DZ forum members. I personally prefer the second one. after all, the first one is still flawed.

Examples in this article describes how to merge discuz user scripts in PHP. Share it with you for your reference. The details are as follows: I encountered a need a few days ago...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.