本文整理汇总了PHP中Authenticate::_setUserTheme方法的典型用法代码示例。如果您正苦于以下问题:PHP Authenticate::_setUserTheme方法的具体用法?PHP Authenticate::_setUserTheme怎么用?PHP Authenticate::_setUserTheme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authenticate
的用法示例。
在下文中一共展示了Authenticate::_setUserTheme方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateAuthUser
public static function validateAuthUser($userCookie = true)
{
if (isset($_COOKIE[COOKIE_USER]) && $_COOKIE[COOKIE_USER] != "") {
$cookieDataArr = explode(".", $_COOKIE[COOKIE_USER]);
if (count($cookieDataArr) == 3) {
list($userID, $cookieExpiration, $cookieHash) = $cookieDataArr;
if ($cookieExpiration > time()) {
$result = dbquery("SELECT * FROM " . DB_USERS . "\n\t\t\t\t\t\tWHERE user_id='" . (isnum($userID) ? $userID : 0) . "' AND user_status='0' AND user_actiontime='0'\n\t\t\t\t\t\tLIMIT 1");
if (dbrows($result) == 1) {
$user = dbarray($result);
Authenticate::_setUserTheme($user);
$key = hash_hmac($user['user_algo'], $userID . $cookieExpiration, $user['user_salt']);
$hash = hash_hmac($user['user_algo'], $userID . $cookieExpiration, $key);
if ($cookieHash == $hash) {
return $user;
} else {
// Cookie has been tampered with!
return Authenticate::logOut();
}
} else {
// User id does not exist or user_status / user_actiontime != 0
return Authenticate::logOut();
}
} else {
// Cookie expired
Authenticate::logOut();
redirect(Authenticate::getRedirectUrl(2));
}
} else {
// Missing arguments in cookie
Authenticate::logOut();
redirect(Authenticate::getRedirectUrl(2));
}
} else {
return Authenticate::getEmptyUserData();
}
}