當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Authorization::logout方法代碼示例

本文整理匯總了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");
     }
 }
開發者ID:schoolphp,項目名稱:library,代碼行數:37,代碼來源:User.php

示例2: logout

 /**
  * logout es para finalizar sesion.
  */
 public function logout()
 {
     $auth = new Authorization();
     $auth->logout();
 }
開發者ID:salvaroad,項目名稱:examen,代碼行數:8,代碼來源:usuariosController.php

示例3: logout

 public function logout()
 {
     /**
      * function to logout of the session
      * @return void
      */
     $auth = new Authorization();
     $auth->logout();
 }
開發者ID:karhega,項目名稱:framework,代碼行數:9,代碼來源:usuariosController.php

示例4: Authorization

<?php

require_once 'classes/authorization.class.php';
$logout = new Authorization();
$logout->logout();
echo '<meta http-equiv=refresh content="0; URL=index.php">';
開發者ID:GeoPvN,項目名稱:epro,代碼行數:6,代碼來源:logout.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;
開發者ID:Rapp-colince,項目名稱:surgeon-report-81,代碼行數:18,代碼來源:authorization.php


注:本文中的Authorization::logout方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。