本文整理汇总了PHP中Authorization::logout方法的典型用法代码示例。如果您正苦于以下问题:PHP Authorization::logout方法的具体用法?PHP Authorization::logout怎么用?PHP Authorization::logout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authorization
的用法示例。
在下文中一共展示了Authorization::logout方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Start
static function Start($auth = [])
{
$called_class = get_called_class();
if (count($auth)) {
$where = [];
foreach ($auth as $k => $v) {
$where[] = "`" . es($k) . "` = '" . es($v) . "'";
}
$res = q("\n\t\t\t\tSELECT `access`" . (count($called_class::$datas) ? ',`' . implode('`,`', $called_class::$datas) . '`' : '') . "\n\t\t\t\tFROM `fw_users`\n\t\t\t\tWHERE " . implode(" AND ", $where) . "\n\t\t\t");
if (!$res->num_rows) {
Authorization::logout();
redirect('/');
}
$row = $res->fetch_assoc();
if ($row['access'] != 1) {
Authorization::logout();
$_SESSION['error'] = 'no-access';
redirect('/');
}
foreach ($called_class::$datas as $k => $v) {
$called_class::${$v} = $row[$v];
// unset($row[$v]); -- Раскомментировать после обновления функционала на сайте
}
if (count($row)) {
self::$data = $row;
}
} elseif (isset($_COOKIE['autologinid'], $_COOKIE['autologinhash'])) {
$auth = new Authorization();
if (!$auth->authByHash($_COOKIE['autologinid'], $_COOKIE['autologinhash'])) {
Authorization::logout();
redirect('/');
}
}
if (!empty(self::$data['id']) && !empty(self::$autoupdate)) {
q("\n\t\t\t\tUPDATE `fw_users` SET\n\t\t\t\t`browser` = '" . (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '') . "',\n\t\t\t\t`ip` = '" . es($_SERVER['REMOTE_ADDR']) . "'\n\t\t\t\tWHERE `id` = " . (int) self::$data['id'] . "\n\t\t\t");
}
}
示例2: logout
/**
* logout es para finalizar sesion.
*/
public function logout()
{
$auth = new Authorization();
$auth->logout();
}
示例3: logout
public function logout()
{
/**
* function to logout of the session
* @return void
*/
$auth = new Authorization();
$auth->logout();
}
示例4: Authorization
<?php
require_once 'classes/authorization.class.php';
$logout = new Authorization();
$logout->logout();
echo '<meta http-equiv=refresh content="0; URL=index.php">';
示例5: Authorization
<?php
require_once CODE_ROOT . '/classes/authorization.php';
$authorization = new Authorization();
if (empty($request_uri[2])) {
$request_uri[2] = '';
}
switch ($request_uri[2]) {
case 'logout':
$authorization->logout();
header('Location: /authorization/login');
die;
break;
default:
$authorization->result['views'] = array('main' => 'login.php');
break;
}
$result = $authorization->result;