xiunoPHP修罗论坛实现同步登陆教程
利用主站校验,跳转回来
《---myCode-Php---》
<?php$action = param(1);if($action == 'login') {
$_SESSION['referer'] = http_referer();
// 发起的 token
$token = xn_encrypt($time."\t".$useragent);
$s = xn_decrypt($token);
$return_url = xn_urlencode(http_url_path().url('user-synlogin'));
http_location(BBS_URL."user-synlogin.htm?token=$token&return_url=$return_url");
// 接受跳转回来的 token} elseif($action == 'synlogin') {
$token = param('token');
$s = xn_decrypt($token);
$arr = xn_json_decode($s);
empty($arr) AND message(-1, 'TOKEN 有错误');
$_SESSION['uid'] = $arr['uid'];
$_SESSION['user'] = $arr;
$referer = $_SESSION['referer'];
unset($_SESSION['referer']);
message(-1, jump('登陆成功', $referer, 2));
} elseif($action == 'create') {
http_location(BBS_URL.url("user-create"));
} elseif($action == 'logout') {
$uid = 0;
unset($_SESSION['uid']);
unset($_SESSION['user']);
message(-1, jump('退出成功', http_referer(), 2));
}?>
《---myCode---》
xiuno修罗问题解决方法教程。
|