Phpcms V9 and Discuz X3.1 realize synchronous Login Exit forum (implemented)

Source: Internet
Author: User

Many articles on the network, according to the steps configured after phpcms can be synchronized login dz, but DZ login state but can not sync to phpcms, the network found a lot of information are similar, head big. Can only debug their own, nonsense not much to say.

The following network copy of the installation steps, keep their own, there are installed can be skipped.First step: Install Phpcms V9. Installing discuz! X3.1 (Install Ucenter at the same time).

Step two: Add "Phpsso app" to Ucenter.

1. Administrator Login discuz! X3.1 Management Center, go to "Ucenter", click "Application Management".
2. Click the "Add New App" button and select Install as "Custom Install". In the expanded Add new app parameter configuration table, the parameters are configured as follows:

Application Name: Phpsso
Application of the main url:http://localhost/phpcms/phpsso_server (required, PHPCMS installation path, depending on the actual situation, and finally not with a slash)
Apply IP: (optional, leave empty normally.) If the Ucenter communication with the app fails because of a domain name resolution problem, try setting the IP address of the server where the app resides. )
Communication key: (Required, PHPCMS's communication key must be consistent with this setting, otherwise Phpsso will not be able to communicate properly with Ucenter.) )
Application Type: Other (required)
Physical path of the application: (optional, left blank by default)
View Profile page address: (optional, the part after the domain name in the URL, such as:/space.php?uid=%s The%s here represents the UID)
Application Interface file name: (optional, default is uc.php)
Label single display template: (optional, default blank)
Label template tag Description: (optional, left blank by default)
Whether to turn on sync login: Yes (optional, turn on sync login when user is logged in discuz! , you will also be logged in to Phpcms. )
Whether to accept the notification: no (optional)

3. After submission, a new app ID will be generated. (Remember this app ID and use it in "step three"). )
4, enter the backstage "webmaster", "Ucenter settings" option. "Allow direct activation", select "Yes".

Step three: Configure Phpsso.
1, administrator login phpcms V9 Admin Center, go to "Phpsso", click "System Settings".
2, in the "System settings" under the "Ucenter Configuration" column, the parameters are configured as follows:

Whether enabled: Yes
Ucenter API Address: Http://localhost/discuz/uc_server (required, Blue font section is discuz! Installation path, depending on the actual situation, do not end with a slash)
Ucenter API IP: (optional, generally do not fill in, encountered can not sync, please fill in the Ucenter host IP address)
Ucenter database hostname: localhost (required, subject to availability)
Ucenter database user name: root (required, subject to availability)
Ucenter Database Password: root (subject to availability)
Ucenter database name: Discuz (required, subject to availability)
Ucenter database table prefix: ' Discuz '. Pre_ucenter_ (required, subject to availability.) If this entry is incorrect, PHPCMS will not be able to register a new member! )
Ucenter database Character Set: UTF-8 (required, subject to availability)
App ID (App ID): (required, this value is automatically when you create the Phpsso app in "Second step" ucenter. )
Ucenter Communication key: (required, be sure to ensure that the value is the same as the Phpsso app key created in step two ucenter. )

3, submit.

Fourth step: Check the communication status.
See if the Phpsso app and Ucenter communication you created in Ucenter were successful.
If the communication is successful, proceed to the next step.
If the communication fails, check that the parameters in step two and step three are configured correctly.

Fifth step: Backup./phpsso. Will discuz! X3.1 Uc_client copied to phpsso_server/api/, overwriting the original uc_client.

Fifth Step I I tried, if the overwrite, phpcms can not sync login to dz, so if the normal synchronization is ignored.

Sixth Step: Modify discuz! Member Login Related
1, modify template\default\member\login.htm 36th line, delete
Onsubmit= "{if $this->setting[' pwdsafety ']}pwmd5 (' Password3_$loginhash '); {/if}pwdclear = 1;ajaxpost (' Loginform_$loginhash ', ' returnmessage_$loginhash ', ' returnmessage_$loginhash ', ' onerror '); return false; "

2, modify template\default\member\login_simple.htm 3rd line, delete
Onsubmit= "{if $_g[' setting '] [' pwdsafety ']}pwmd5 (' Ls_password '); {/if}return lssubmit (); "

3, modify/source/function/function_message.php line 78th, find
$param [' header '] = true;
To be replaced by:
$param [' header '] = false;

The above configuration content in the evening basically can achieve phpcms and DZ synchronization. DZ synchronization is not necessarily. The following configuration is required:

Locate the uc_client\data\cache\apps.php under the DZ folder. Find the file and see if there is only one

$_cache[' apps ' = Array (

1 =

Array (omitted here ...),

You need to add the content we just created here:

2 =

Array (

' AppID ' = ' 2 ',

' Type ' = ' phpcms main Station ',

' name ' = ' Phpcms Main Station ',

' url ' = ' http://127.0.0.1:82/phpcms/phpsso_server ',

' IP ' = ',

' Viewprourl ' = ',

' Apifilename ' = ' uc.php ',

' CharSet ' = ',

' Dbcharset ' = ',

' Synlogin ' = ' 1 ',

' Recvnote ' = ' 1 ',

' Extra ' = False,

' Tagtemplates ' = ',

' Allowips ' = ',

),

Complete the above code should be perfectly synchronized.

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.