本文整理匯總了PHP中Authenticate::_setCookie方法的典型用法代碼示例。如果您正苦於以下問題:PHP Authenticate::_setCookie方法的具體用法?PHP Authenticate::_setCookie怎麽用?PHP Authenticate::_setCookie使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Authenticate
的用法示例。
在下文中一共展示了Authenticate::_setCookie方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setLastVisitCookie
public static function setLastVisitCookie()
{
global $userdata;
$guest_lastvisit = time() - 3600;
$update_threads = false;
$set_cookie = true;
$cookie_exists = isset($_COOKIE[COOKIE_LASTVISIT]) && isnum($_COOKIE[COOKIE_LASTVISIT]) ? true : false;
if (iMEMBER) {
if ($cookie_exists) {
if ($_COOKIE[COOKIE_LASTVISIT] > $userdata['user_lastvisit']) {
$update_threads = true;
$lastvisit = $userdata['user_lastvisit'];
} else {
$set_cookie = false;
$lastvisit = $_COOKIE[COOKIE_LASTVISIT];
}
} else {
$update_threads = true;
$lastvisit = $userdata['user_lastvisit'];
}
if ($update_threads) {
dbquery("UPDATE " . DB_USERS . " SET user_threads='' WHERE user_id='" . $userdata['user_id'] . "'");
}
} else {
if ($cookie_exists) {
if ($_COOKIE[COOKIE_LASTVISIT] > $guest_lastvisit) {
$lastvisit = $guest_lastvisit;
} else {
$set_cookie = false;
$lastvisit = $_COOKIE[COOKIE_LASTVISIT];
}
} else {
$lastvisit = $guest_lastvisit;
}
}
if ($set_cookie) {
Authenticate::_setCookie(COOKIE_LASTVISIT, $lastvisit, time() + 3600, COOKIE_PATH, COOKIE_DOMAIN, false, true);
}
return $lastvisit;
}