How to configure phpcmsv9 to integrate DiscuzX3 synchronous login and exit

Source: Internet
Author: User
Many webmasters use Phpcmsv9 to build the main site and then use Discuz! X3. construct a website forum so that a website has two user centers, phpsso and Discuz of Phpcmsv9! The UCenter of X3. This requires the integration of the two programs to achieve synchronous registration, synchronous login, and synchronous logout. This tutorial uses UCenter as the service

Many webmasters use Phpcms v9 to build the main site and then use Discuz! X3. construct a website forum so that a website has two user centers, phpsso and Discuz of Phpcms v9! The UCenter of X3. This requires the integration of the two programs to achieve synchronous registration, synchronous login, and synchronous logout.

This tutorial uses UCenter as the server, phpsso and Discuz! X3 serves as the client application of UCenter respectively. Phpsso and Discuz! X3 interacts with Discuz through UCenter, while Phpcms v9 interacts with Discuz through phpsso! X3. The integration steps are as follows:

Step 1: fully install Phpcms v9 and Discuz! Latest version of X3

Install Phpcms v9 in the root directory, and create a new bbs directory in the root directory to install Discuz! X3. in this tutorial, the path is taken as an example. when operating on the installation directory, webmasters should change the path based on their actual conditions. The latest version of the program is used in the production and testing of this tutorial, so it is not guaranteed that all versions can be integrated successfully According to this tutorial. we recommend that you upgrade the program to the latest version.

Step 2: add the "phpsso application" to the UCenter"

Log on to Discuz! In the X3 background, go to "UCenter", click "application management", and click "add new application" to go to the application addition page. The settings are as follows:

1. select "custom installation" for the installation method"

2. select "other" for the application type"

3. enter "phpsso" in the application name"

4. the main URL of the application, that is, the path of phpsso_server, depends on the actual situation. Be sure not to include a slash at last. In this tutorial, enter http: // 127.0.0.1/phpsso_server

5. enter any English letters and numbers within 64 bytes of the communication key, but remember that the communication key of phpcms must be consistent with this setting. otherwise, phpsso cannot communicate with UCenter normally. In this tutorial, set the communication key to chinaz.

6. leave the application IP address, the physical path of the application, and the address on the personal data page blank by default. the application interface file name is uc. php by default.

7. the tag display template and tag template are left blank by default.

8. whether to enable synchronous logon: Yes. Only after the two programs are enabled can synchronous logon be performed.

9. after submission, a new application ID is generated. (Remember this application ID, which will be used in step 3 .)

10. go to "webmaster" and "UCenter settings" in the background ." Whether to allow direct activation. select "yes ".

Configure phpsso in Phpcms v9.

Step 3: Configure phpsso

Log on to the Phpcms v9 background, go to phpsso, and click system settings to go to the UCenter configuration page. The settings are as follows:

Note: Copy the symbol 'ucenter'. uc _ in front of the database.

1. enabled or not: Yes

2. the Ucenter api address, that is, the path of the uc_server, depends on your installation. do not use a slash at last. In this tutorial, enter http: // localhost/bbs/uc_server.

3. Ucenter database information: Enter the database information as needed. The format of the database table prefix is "'database name'. database prefix". Note that the database name is not a single quotation mark.

4. Application id (app id), that is, the application ID automatically generated when the phpsso application is created in step 2.

5. the Ucenter communication key, that is, the "communication key" set in step 2, must be consistent. otherwise, communication will fail.

Step 4: view the communication status

Log on to Discuz! In the X3 background, go to "UCenter" and click "application management" to check whether the phpsso application created in step 2 has successfully communicated with the UCenter. If the communication fails, check whether the parameters in step 2 and step 3 are correctly configured.

Step 5: modify Discuz! X3 member logon problems.

If this parameter is not modified, you can log on to Discuz synchronously after logging on to Phpcms v9! X3, but in Discuz! But cannot log on to Phpcms v9 synchronously. The modification procedure is as follows:

1. findDiscuzDelete template/default/member/login.htm under the Directory


Onsubmit = "{if $ this-> setting ['pwdsafety ']} pwmd5 ('password3 _ $ loginhash ');
{/If} pwdclear = 1; ajaxpost ('loginform _ $ loginhash', 'returnmessage _
$ Loginhash ', 'returnmessage _ $ loginhash', 'onerror'); return false ;"

Note that if you do not delete the file, it will never be synchronized. (I tested it)


Onsubmit = "ajaxpost ('lostpwform _ $ loginhash', 'returnmessage3 _ $ loginhash', 'returnmessage3 _ $ loginhash', 'onerror'); return false ;"

2. locate templatedefaultmemberlogin_s imple.htm in the discuz directory and delete it.


Onsubmit = "{if $ _ G ['setting'] ['pwdsafety ']} pwmd5 ('ls _ password'); {/if} return
LsSubmit ();"

3. find/source/function/function_message.php in the discuz directory and find


$ Param ['header'] = true;

Replace


$ Param ['header'] = false;

Step 6: integration completed

After integration with the editor, we have made any modifications. after testing, we have fully realized synchronous registration, synchronous login, and synchronous logout. Only because of the program, the account registered in phpcms must be synchronized after Discuz is logged on once. this is a program restriction and cannot be solved. In addition, it is found that many webmasters successfully communicate after integration, but the registration and login operations fail. please note the format of the database table prefix in step 3.

FAQs:

1. what should I do if phpcms registration or logon fails after integration?

A: This may be because you cannot connect to the UCenter. You can try to modify the file

Phpsso_server/api/uc_client/model/base. php

Run $ this-> db-> connect (UC_DBHOST, UC_DBUSER, UC_DBPW, ", UC_DBCHARSET, UC_DBCONNECT, UC_DBTABLEPRE) on the first line );

Replace with: $ this-> db-> connect (UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET, UC_DBCONNECT, UC_DBTABLEPRE );

2. why not use the official UCenter client?

A: The official UCenter client version is 1.5.1 Release 20100501, while Discuz! The version used by X3 is 1.6.0. The version is inconsistent and cannot be integrated successfully.

3. what results can be achieved after successful integration?

A: implement phpcms and Discuz! Mutual synchronous registration, logon, and logout of members.

4. the first member registered in phpcms must be in Discuz! Log on once and log on synchronously next time. Is this normal?

A: normal. Because phpsso is a third-party UCenter application, it must be in Discuz! Login activated.

If you are in Discuz! If you have trouble activating the service, contact me. we will provide commercial services to help you solve this problem.

5. after a member logs on to phpcms, the member does not log on to Discuz synchronously! What should I do?

A: This is probably because the "UCenter configuration" of phpsso is incorrect. check the parameter settings carefully.

6. members are on Discuz! After logging on, I have not logged on to phpcms synchronously. what should I do?

A: This is probably because the UCenter phpsso application configuration is incorrect. check the parameter settings carefully.

Note:
For example, if $ _ config ['cooker'] ['cookiedomain '] = "is configured in Discuz, the corresponding phpcms settings must be the same. if you do not log on and exit synchronously, the system will fail.

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.