本文整理汇总了PHP中SessionManager::isAuthorized方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionManager::isAuthorized方法的具体用法?PHP SessionManager::isAuthorized怎么用?PHP SessionManager::isAuthorized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SessionManager
的用法示例。
在下文中一共展示了SessionManager::isAuthorized方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
if (SessionManager::isAuthorized()) {
header('Location:/main');
die;
}
}
示例2: SessionManager
/**
* Created by PhpStorm.
* User: Dushyant
* Date: 2015-07-25
* Time: 11:47 PM
*/
require_once '../../Local/Classes/config.inc';
require_once '../../Local/Classes/class.SessionManager.inc';
session_start();
//Don't allow user to access this page with out logging in and if user role != "Admin"
//Check if user is login or redirect to log in page.
if (isset($_SESSION['loginUserId'])) {
$userSession = new SessionManager();
//if user is log in check user is authorized to use admin pages.
//if not authorized redirect to login page.
if (!$userSession->isAuthorized('Admin', $_SESSION['loginUserRole'])) {
header('Location: ../login.php');
}
} else {
header('Location: ../login.php');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">