本文整理匯總了PHP中IEM::requestGetCookie方法的典型用法代碼示例。如果您正苦於以下問題:PHP IEM::requestGetCookie方法的具體用法?PHP IEM::requestGetCookie怎麽用?PHP IEM::requestGetCookie使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IEM
的用法示例。
在下文中一共展示了IEM::requestGetCookie方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: User_API
// Get user
$tempUser = new User_API();
$tempUser->Load(intval($tempCookie['user']));
// Check if the user is a valid user
if (!isset($tempUser->settings['LoginCheck']) || !$tempUser->userid || !$tempUser->Status()) {
break;
}
// Check whether or not the random number matches
if (!$tempUser->settings['LoginCheck'] == $tempCookie['rand']) {
break;
}
// The cookie is valid! Update session accordingly
IEM::userLogin($tempUser->userid);
$tempValid = true;
// Check if we have login preferences
$tempLoginPref = IEM::requestGetCookie('IEM_LoginPreference', array());
if (is_array($tempLoginPref) && isset($tempLoginPref['takemeto'])) {
header('Location: ' . SENDSTUDIO_APPLICATION_URL . '/admin/' . $tempLoginPref['takemeto']);
}
break;
}
if (!$tempValid) {
$page = 'login';
}
unset($tempValid);
unset($tempCookie);
unset($tempUser);
} else {
$tempUser = GetUser();
if (!$tempUser->Find($tempUser->username)) {
$page = 'login';
示例2: ShowLoginForm
/**
* ShowLoginForm
* This shows the login form.
* If there is a template to use in the data/templates folder it will use that as the login form.
* Otherwise it uses the default one below. If you pass in a message it will show that message above the login form.
*
* @param String $template Uses the template passed in for the message (eg success / error).
* @param String $msg Prints the message passed in above the login form (eg unsuccessful attempt).
*
* @see FetchTemplate
* @see PrintHeader
* @see PrintFooter
*
* @return Void Doesn't return anything, just prints the login form.
*/
function ShowLoginForm($template=false, $msg=false)
{
if (!IEM::getCurrentUser()) {
$this->GlobalAreas['InfoTips'] = '';
}
$this->PrintHeader(true);
$GLOBALS['Message'] = GetLang('Help_Login');
if ($template && $msg) {
switch ($template) {
case 'login_error':
$GLOBALS['Error'] = $msg;
break;
case 'login_success':
$this->GlobalAreas['Success'] = $msg;
break;
}
$GLOBALS['Message'] = $this->ParseTemplate($template,true);
}
$username = IEM::requestGetPOST('ss_username', false);
if ($username) {
$GLOBALS['ss_username'] = htmlspecialchars($username, ENT_QUOTES, SENDSTUDIO_CHARSET);
}
$GLOBALS['ss_takemeto'] = 'index.php';
$loginPreference = IEM::requestGetCookie('IEM_LoginPreference', array());
if (is_array($loginPreference) && isset($loginPreference['takemeto'])) {
$GLOBALS['ss_takemeto'] = $loginPreference['takemeto'];
}
$this->GlobalAreas['SubmitAction'] = 'Login';
$this->ParseTemplate('login');
$this->PrintFooter(true);
}