【Discuz】Discuz 论坛 对接第三方登陆功能笔记整理/通过uid免登陆
UID可以换成Token ,php获取到token之后通过api/或者redis获取到用户信息 进行免登陆
<?php/*** [Discuz!] (C)2001-2099 Comsenz Inc.* This is NOT a freeware, use is subject to license terms** $Id: uc.php 36358 2017-01-20 02:05:50Z nemohou $*/define('IN_DISCUZ', true);define('UC_CLIENT_VERSION', '1.6.0');
define('UC_CLIENT_RELEASE', '20170101');define('API_DELETEUSER', 1);
define('API_RENAMEUSER', 1);
define('API_GETTAG', 1);
define('API_SYNLOGIN', 1);
define('API_SYNLOGOUT', 1);
define('API_UPDATEPW', 1);
define('API_UPDATEBADWORDS', 1);
define('API_UPDATEHOSTS', 1);
define('API_UPDATEAPPS', 1);
define('API_UPDATECLIENT', 1);
define('API_UPDATECREDIT', 1);
define('API_GETCREDIT', 1);
define('API_GETCREDITSETTINGS', 1);
define('API_UPDATECREDITSETTINGS', 1);
define('API_ADDFEED', 1);
define('API_RETURN_SUCCEED', '1');
define('API_RETURN_FAILED', '-1');
define('API_RETURN_FORBIDDEN', '1');define('IN_API', true);
define('CURSCRIPT', 'api');include './source/function/function_core.php';
include './source/function/function_member.php';if(!defined('IN_UC')) {require_once './source/class/class_core.php';$discuz = C::app();$discuz->init();require DISCUZ_ROOT.'./config/config_ucenter.php';// $uid = 1;global $_G;$cookietime = 31536000;$uid = intval($_GET['uid']);$member = getuserbyuid($uid, 1);setloginstatus($member, $cookietime);header('Location: http://127.0.0.1:10005/');
exit;}echo 'ok'.$uid;
?>