本文整理汇总了PHP中checkRole函数的典型用法代码示例。如果您正苦于以下问题:PHP checkRole函数的具体用法?PHP checkRole怎么用?PHP checkRole使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checkRole函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkIfAdminIsLoggedOn
function checkIfAdminIsLoggedOn()
{
if (checkRole($_SESSION['gebruiker_id']) == 3) {
header('Location: ' . BASE_URL . 'admin');
exit;
}
}
示例2: checkIfAdmin
function checkIfAdmin()
{
if (checkRole($_SESSION['gebruiker_id']) != 3) {
header('Location: ' . BASE_URL . 'dashboard/');
exit;
}
}
示例3: init
public function init()
{
parent::init();
if (!defined("CORE")) {
checkRole('/framework/admin/' . $this->_mvc_name . '/view', false);
} else {
checkPerm('view', false, $this->_mvc_name, 'framework');
}
}
示例4: checkActorEntry
/**
* This function is called when adding a new film and when inserting
* name and roles for new actors. Checks an entry to see if it is a
* valid actor by checking its ID and also if the role assigned to it
* is a valid role and returns a number according to these tests.
* @param String $Fname
* @param String $Lname
* @param String $role
* @return number - 0 if actor and role are valid, 1 if actor not valid,
* 2 if actor valid but role invalid
*/
function checkActorEntry($Fname, $Lname, $role)
{
if (getActorIdByName($Fname, $Lname) != null) {
if (checkRole($role)) {
return 0;
} else {
return 2;
}
} else {
return 1;
}
}
示例5: show
public function show()
{
if (!defined("LMS")) {
checkRole('/lms/course/public/profile/view', false);
} else {
checkPerm('view', false, 'profile', 'lms');
}
require_once _lms_ . '/lib/lib.lms_user_profile.php';
$id_user = Docebo::user()->getIdST();
$profile = new LmsUserProfile($id_user);
$profile->init('profile', 'framework', 'r=lms/profile/show', 'ap');
//'modname=profile&op=profile&id_user='.$id_user
$_check = false;
if (!defined("LMS")) {
$_check = checkRole('/lms/course/public/profile/mod', true);
} else {
$_check = checkPerm('mod', true, 'profile', 'lms');
}
if ($_check) {
$profile->enableEditMode();
}
//view part
if (Get::sett('profile_only_pwd') == 'on') {
echo $profile->getTitleArea();
echo $profile->getHead();
echo $profile->performAction(false, 'mod_password');
echo $this->_profileBackUrl();
echo $profile->getFooter();
} else {
echo $profile->getTitleArea();
echo $profile->getHead();
echo $profile->performAction();
echo $this->_profileBackUrl();
echo $profile->getFooter();
}
}
示例6: checkSession
checkSession();
checkIfAdminIsLoggedOn();
if (isset($_POST['klasid'])) {
} else {
header('Location: ' . BASE_URL . 'dashboard/resultatenklassen.php');
}
$klasid = $_POST['klasid'];
$klasinfo = getInfooneKlas($klasid);
$leerlingen = getStudentNamesfromoneKlas($klasid);
$categorieen = getCategorie();
include ROOT_PATH . "includes/templates/header.php";
?>
<div class="wrapper">
<?php
//als docent ingelogd is sidebar-docent anders sidebar-leerling
if (checkRole($_SESSION['gebruiker_id']) == 2) {
include ROOT_PATH . "includes/templates/sidebar-docent.php";
} else {
include ROOT_PATH . "includes/templates/sidebar-leerling.php";
}
?>
<div class="page-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-sm-8">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Resultaten:</h3>
</div>
<div class="panel-body">
示例7: function
|
*/
Route::filter('auth', function () {
if (Auth::guest()) {
if (Request::ajax()) {
return Response::make('Unauthorized', 401);
} else {
return Redirect::guest('login');
}
}
});
Route::filter('auth.basic', function () {
return Auth::basic();
});
Route::filter('member', function () {
if (checkRole('member')) {
return Redirect::to('reservation');
}
});
/*
|--------------------------------------------------------------------------
| Guest Filter
|--------------------------------------------------------------------------
|
| The "guest" filter is the counterpart of the authentication filters as
| it simply checks that the current user is not logged in. A redirect
| response will be issued if they are, which you may freely change.
|
*/
Route::filter('guest', function () {
if (Auth::check()) {
示例8: checkRole
<?php
checkRole();
?>
<section id="main-wraper" class="row">
<div id="sidebar" class="col-md-3">
<?php
require_once CNS_INCLUDES . 'common/navigation.php';
?>
</div>
<div id="main-content" class="col-md-9">
<h1 class="text-center">Wellcome to Water Manage System 2015</h1>
<div class="acountDb col-md-6">
<?php
$user = new Users();
echo "<span class='text-center'>Tổng Số Tài Khoản Quản Lý: " . $user->countUser() . '</span>';
?>
</div>
<div class="room-memberDb col-md-6">
<?php
$member = new Members();
$data = $member->listAll();
$count = count($data);
echo "<span class='text-center'>Tổng Số Thành viên Quản Lý: " . $count . '</span>';
?>
<ul class="">
<?php
foreach ($data as $mem) {
echo "<li>{$mem['firstname']} {$mem['lastname']}</li>";
}
?>
示例9: dirname
<?php
/************************************************************
* 角色
************************************************************/
require_once dirname(__FILE__) . '/common/commonFunc.php';
$conn = createConn();
// 创建数据库连接
$op = $_GET['op'];
// 操作类型
$roleId = isset($_GET['roleId']) ? $_GET['roleId'] : "";
switch ($op) {
case "checkRole":
checkRole($roleId);
break;
case "updateRole":
updateRole($roleId);
$statusCode = "200";
$message = "修改角色成功";
$callbackType = "closeCurrent";
$navTabId = "oa3";
$rel = $forwardUrl = $confirmMsg = "";
break;
}
mysql_close($conn);
include dirname(__FILE__) . '/common/message.php';
/**
*检验角色名是否已存在
**/
function checkRole($roleId)
{
示例10: Man_Message
);
$menu_i++;
}*/
// Menu for messages
if ($ma->currentCanAccessObj('mo_message')) {
require_once $GLOBALS['where_framework'] . '/lib/lib.message.php';
$msg = new Man_Message();
$unread_num = $msg->getCountUnreaded(getLogUserId(), array(), '', true);
$menu['all'][] = array('index.php?modname=message&op=message&sop=unregistercourse', Lang::t('_MESSAGES', 'menu_over') . ($unread_num ? ' <b class="num_notify">' . $unread_num . '</b>' : ''), false);
$menu_i++;
}
// Customer help
if ($ma->currentCanAccessObj('mo_help')) {
$help_email = trim(Get::sett('customer_help_email', ''));
$can_send_emails = !empty($help_email) ? true : false;
$can_admin_settings = checkRole('/framework/admin/setting/view', true);
if ($can_send_emails) {
cout(Util::get_js(Get::rel_path('base') . '/lib/js_utils.js', true), 'scripts');
cout(Util::get_js(Get::rel_path('lms') . '/modules/customer_help/customer_help.js', true), 'scripts');
cout('<script type="text/javascript">' . ' var CUSTOMER_HELP_AJAX_URL = "ajax.server.php?mn=customer_help&plf=lms&op=getdialog"; ' . ' var ICON_LOADING = "' . Get::tmpl_path() . 'images/standard/loadbar.gif"; ' . ' var LANG = new LanguageManager({' . ' _CONFIRM: "' . Lang::t('_CONFIRM') . '",' . ' _UNDO: "' . Lang::t('_UNDO') . '",' . ' _COURSE_NAME: "' . Lang::t('_COURSE_NAME', 'course') . '",' . ' _VAL_COURSE_NAME: "' . (isset($GLOBALS['course_descriptor']) ? $GLOBALS['course_descriptor']->getValue('name') : "") . '",' . ' _DLG_TITLE: "' . Lang::t('_CUSTOMER_HELP', 'customer_help') . '",' . ' _LOADING: "' . Lang::t('_LOADING') . '"' . '}); ' . '</script>', 'scripts');
$menu['all'][] = array('#', Lang::t('_CUSTOMER_HELP', 'customer_help'), false);
$customer_help = ++$menu_i;
$setup_menu .= " oMenuBar.getItem({$customer_help}).subscribe('click', CustomerHelpShowPopUp);";
} else {
if ($can_admin_settings) {
$menu['all'][] = array('../appCore/index.php?r=adm/setting/show', '<i>(' . Lang::t('_CUSTOMER_HELP', 'customer_help') . ': ' . Lang::t('_SET', 'standard') . ')</i>', false);
}
}
}
// Menu for the public admin
if ($user_level == ADMIN_GROUP_PUBLICADMIN && !empty($menu['public_admin'])) {
示例11: markLoggedIn
function markLoggedIn($conn)
{
$username = $_POST['user'];
// user-ul din formular
$keep = $_POST['keep'];
// checkbox-ul din formular
$ip = $_SERVER['REMOTE_ADDR'];
// ip-ul vizitatorului
$via = 'form';
// s-a logat prin formular, nu prin cookie
// creez o structura de date
$data = array();
$data['loggedIn'] = true;
$data['username'] = $username;
$data['loginDate'] = time();
$data['lastAccess'] = time();
$data['keepLoggedIn'] = $keep;
$data['ip'] = $ip;
$data['via'] = $via;
// pastrez in sesiune
$_SESSION['LOGIN'] = $data;
// daca trebuie sa tin minte loginul, creez un cookie
if ($keep == 1) {
/* setez un cookie ce contine structura creata mai sus si care
* va expira in 30 de zile; structura de date este serializata
* adica transformata intr-un format ce poate fi stocat ca text
* dupa serializare, textul returnat este encodat cu algoritmul
* base64 la care se adauga caracterul '1' pentru a ingreuna
* decodificarea continutului */
setcookie('logindata', '1' . base64_encode(serialize($data)), time() + 2592000, '/');
} else {
// sterg cookie-ul prin setarea valabilitatii la o data din trecut
setcookie('logindata', "", time() - 36000, '/');
}
echo checkRole($username, $conn);
// acum ca am salvat datele pe sesiune (si posibil in cookies), redirectionez
if (checkRole($username, $conn) == 'admin') {
header('Location: insert.php');
} else {
header('Location: personalPage.php');
}
// opresc executia scriptului curent
exit;
}