ucenter 4站同步_用户登陆

其中fleam站的登陆代码为下,通过登陆fleam的账号,引发其他3个站点的登陆

<meta charset="utf8">

<?php
include 'config.inc.php';
include 'uc_client/client.php';

    list($uid, $username, $password, $email) = uc_user_login("fleam", "fleam");

    setcookie('Example_auth', '', -86400);

        //用户登陆成功,设置 Cookie,加密直接用 uc_authcode 函数,用户使用自己的函数
        setcookie('Example_auth', uc_authcode($uid."\t".$username, 'ENCODE'));
        //生成同步登录的代码
        $ucsynlogin = uc_user_synlogin($uid);
        echo '登录成功'.$ucsynlogin;

?>

Discuz!是官方论坛,没什么好说的

examples是官网上自带的列子

example1是复制的examples

当我登陆fleam时(http://localhost/fleam/login.action.php)

ucenter 4站同步_知识_02

 

论坛反映为

 

 

ucenter 4站同步_知识_03

examples反映为

ucenter 4站同步_官网_04

但是example1却无任何反应

网上查了下,估计是COOKIE设置的问题,遂把examples和example1的COOKIE设置都改了下(原来的都是$_COOKIE['Example_auth'])

 

 

ucenter 4站同步_官网_05

 

 

ucenter 4站同步_用户登陆_06

 

 

测试,四站同步登陆、同步退出成功