Authored by 周少峰

decrypt uid

... ... @@ -21,6 +21,7 @@ use WebPlugin\Mobile;
use Api\Yohobuy;
use LibModels\Web\Passport\LoginData;
use WebPlugin\UdpLog;
use WebPlugin\Encryption;
class WebAction extends Controller_Abstract
{
... ... @@ -382,6 +383,7 @@ class WebAction extends Controller_Abstract
$userInfo = LoginData::profile($uid);
if (isset($userInfo['data']) && $userInfo['data']) {
$token = Helpers::makeToken($uid);
$userInfo['data']['uid'] = Encryption::encrypt($userInfo['data']['uid']);
$uidCookie = $userInfo['data']['profile_name'] . '::' . $userInfo['data']['uid'] . '::' . $userInfo['data']['vip_info']['title'] . '::' . $token;
$this->setCookie('_UID',$uidCookie,time() + 86400 * 360);
UdpLog::info('syncUserCookie :',$uidCookie);
... ... @@ -411,7 +413,8 @@ class WebAction extends Controller_Abstract
// 兼容老的
if (!empty($cookie)) {
$cookieList = explode('::', $cookie);
if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
$cookieList[1] = Encryption::decrypt($cookieList[1]);
if (isset($cookieList[1]) && $cookieList[1]) {
if ($useSession) {
$token = $this->getSession('_TOKEN');
if (empty($token)) {
... ... @@ -437,7 +440,7 @@ class WebAction extends Controller_Abstract
}
}
}
return $this->_uid;
return intval($this->_uid);
}
/**
... ...