本文整理汇总了PHP中Authorization::logOut方法的典型用法代码示例。如果您正苦于以下问题:PHP Authorization::logOut方法的具体用法?PHP Authorization::logOut怎么用?PHP Authorization::logOut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authorization
的用法示例。
在下文中一共展示了Authorization::logOut方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: approveUser
function approveUser($login, $pass, $createIP)
{
if ($this->checkPass($pass, $login)) {
#ПРОВЕРЯЕМ ПРАВИЛЬНОСТЬ ПАРОЛЯ
$ip = 0;
$time = time() + 60 * 2;
$this->hash = md5($this->generateCode(10));
if ($createIP) {
$ip = ip2long($_SERVER['REMOTE_ADDR']);
}
$this->prepareQuery("INSERT INTO sessions SET user_id=:id, time=:time, hash=:hash, ip=:ip");
/*$this->prepareQuery("UPDATE user SET hash=:hash, ip=:ip WHERE id=:id");*/
$this->query->bindParam(':hash', $this->hash);
$this->query->bindParam(':ip', $ip);
$this->query->bindParam(':id', $this->thisUser['user_id']);
$this->query->bindParam(':time', $time);
// Два часа!
$this->executeQuery_Simple();
$this->createCookie();
// Создаем куки
/* $this->deleteOldSessions(); // Удаляем устаревшие сессии*/
return true;
} else {
$this->errors['password_login'] = 'has-error';
// class из bootstrap
Authorization::logOut();
return false;
}
}
示例2: mainApproveLogin
public function mainApproveLogin()
{
if (isset($_COOKIE['user_id']) and isset($_COOKIE['hash'])) {
$this->prepareQuery("SELECT * FROM sessions WHERE user_id = :id AND hash=:hash LIMIT 1");
$this->query->bindParam(':id', intval($_COOKIE['user_id']));
$this->query->bindParam(':hash', $_COOKIE['hash']);
$userData = $this->executeQuery_Row();
if ($userData['hash'] !== $_COOKIE['hash'] or $userData['user_id'] !== $_COOKIE['user_id'] or long2ip($userData['ip']) !== $_SERVER['REMOTE_ADDR'] and $userData['user_id'] !== "0" or $userData['time'] < time()) {
#в этом случае сносим существующие куки
$this->deleteSessions();
Authorization::logOut();
return false;
} else {
return true;
}
} else {
return false;
}
}
示例3: actionLog_out
public function actionLog_out()
{
Authorization::logOut();
}