UC Sync Login Sync exit

Source: Internet
Author: User
Tags php and

Almost every application in the integration of UC will be unable to synchronize the login synchronization exit situation, the reason for today's analysis

First of all, our project will uc_client this folder intact copy to the project root directory,

Public Function Intelogin ($loginname, $password) {
$this->_INITUC ();
if (true = = = $this->uc_integration) {
if (true = = = Xvalid::isemail ($loginname)) {
$logintype = 2;
}
else {
$logintype = 0;
}
if (uc_charset! = Oesoft_charset) {
$uc _loginname = XHANDLE::UTFTOGBK ($loginname);
}
else {
$uc _loginname = $loginname;
}
$this->ucinfo = Uc_user_login ($uc _loginname, $password, $logintype, 0);
if ($this->ucinfo[0] >0) {
Sync Login
Print_r ($this->ucinfo);
Echo Uc_user_synlogin ($this->ucinfo[0]);

The following is the logic of landing the system
$this->_loginuctolove ($password);
}
}
}
I only intercepted a piece of code, the code is to call Client.php's Uc_user_login method, and then determine whether the returned UID exists, the presence of Echo Uc_user_synlogin ($this->ucinfo[0]); This enables the simultaneous landing. But you may encounter a problem, is still unable to synchronize the landing, we look at the code

function Uc_user_synlogin ($uid) {
$uid = Intval ($uid);
if (@include uc_root. /data/cache/apps.php ') {
if (count ($_cache[' apps ') > 1) {
$return = uc_api_post (' user ', ' synlogin ', Array (' uid ' = = $uid));
} else {
$return = ";
}
}
return $return;
}

Find Count ($_cache[' apps ']) > 1, that is, the apps array in apps.php must be greater than 1 to be a helper, otherwise do not call, here we need to note is in your application if it is in the creation of the Uc_client code before the establishment, This will not be greater than 1, it doesn't matter, we can copy the past. apps.php

Synchronous exit is also the same, because he is sending JS to achieve synchronous exit, so

Public Function Intelogout () {
$this->_INITUC ();
if (true = = = $this->uc_integration) {
echo uc_user_synlogout ();
}
}

And remember that it's echo, not return.



When we do the application development, contains two files, one of course the configuration file, whether you fill in the background or write directly to the file, included in the line, and then is client.php,client.php is the processing program.

The code in this document references the code in the action.passport.php and model.uc.php as needed to complete, open them and see for yourself.

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.