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.