当前位置: 首页>>代码示例>>PHP>>正文


PHP Authenticate::logOut方法代码示例

本文整理汇总了PHP中Authenticate::logOut方法的典型用法代码示例。如果您正苦于以下问题:PHP Authenticate::logOut方法的具体用法?PHP Authenticate::logOut怎么用?PHP Authenticate::logOut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Authenticate的用法示例。


在下文中一共展示了Authenticate::logOut方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: define

    $base_url_count--;
}
// New in SEO - disable TRUE_PHP_SELF and START_PAGE
if (!defined("IN_PERMALINK")) {
    define("TRUE_PHP_SELF", $current_page);
    define("START_PAGE", substr(preg_replace("#(&|\\?)(s_action=edit&shout_id=)([0-9]+)#s", "", TRUE_PHP_SELF . (FUSION_QUERY ? "?" . FUSION_QUERY : "")), 1));
}
// Autenticate user
require_once CLASSES . "Authenticate.class.php";
// Log in user
if (isset($_POST['login']) && isset($_POST['user_name']) && isset($_POST['user_pass'])) {
    $auth = new Authenticate($_POST['user_name'], $_POST['user_pass'], isset($_POST['remember_me']) ? TRUE : FALSE);
    $userdata = $auth->getUserData();
    unset($auth, $_POST['user_name'], $_POST['user_pass']);
} elseif (isset($_GET['logout']) && $_GET['logout'] == "yes") {
    $userdata = Authenticate::logOut();
    redirect(BASEDIR . "index.php");
} else {
    $userdata = Authenticate::validateAuthUser();
    // ok userdata never add _1.
}
// User level, Admin Rights & User Group definitions
define("iGUEST", $userdata['user_level'] == 0 ? 1 : 0);
define("iMEMBER", $userdata['user_level'] >= 101 ? 1 : 0);
define("iADMIN", $userdata['user_level'] >= 102 ? 1 : 0);
define("iSUPERADMIN", $userdata['user_level'] == 103 ? 1 : 0);
define("iUSER", $userdata['user_level']);
define("iUSER_RIGHTS", $userdata['user_rights']);
define("iUSER_GROUPS", substr($userdata['user_groups'], 1));
// check multilang tables
function multilang_table($table)
开发者ID:WuChEn,项目名称:PHP-Fusion,代码行数:31,代码来源:maincore.php

示例2: validateAuthUser

 public static function validateAuthUser($userCookie = true)
 {
     if (isset($_COOKIE[COOKIE_USER]) && $_COOKIE[COOKIE_USER] != "") {
         $cookieDataArr = explode(".", $_COOKIE[COOKIE_USER]);
         if (count($cookieDataArr) == 3) {
             list($userID, $cookieExpiration, $cookieHash) = $cookieDataArr;
             if ($cookieExpiration > time()) {
                 $result = dbquery("SELECT * FROM " . DB_USERS . "\n\t\t\t\t\t\tWHERE user_id='" . (isnum($userID) ? $userID : 0) . "' AND user_status='0' AND user_actiontime='0'\n\t\t\t\t\t\tLIMIT 1");
                 if (dbrows($result) == 1) {
                     $user = dbarray($result);
                     Authenticate::_setUserTheme($user);
                     $key = hash_hmac($user['user_algo'], $userID . $cookieExpiration, $user['user_salt']);
                     $hash = hash_hmac($user['user_algo'], $userID . $cookieExpiration, $key);
                     if ($cookieHash == $hash) {
                         return $user;
                     } else {
                         // Cookie has been tampered with!
                         return Authenticate::logOut();
                     }
                 } else {
                     // User id does not exist or user_status / user_actiontime != 0
                     return Authenticate::logOut();
                 }
             } else {
                 // Cookie expired
                 Authenticate::logOut();
                 redirect(Authenticate::getRedirectUrl(2));
             }
         } else {
             // Missing arguments in cookie
             Authenticate::logOut();
             redirect(Authenticate::getRedirectUrl(2));
         }
     } else {
         return Authenticate::getEmptyUserData();
     }
 }
开发者ID:dioda,项目名称:phpfusion,代码行数:37,代码来源:Authenticate.class.php


注:本文中的Authenticate::logOut方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。