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


PHP isAuthorized函数代码示例

本文整理汇总了PHP中isAuthorized函数的典型用法代码示例。如果您正苦于以下问题:PHP isAuthorized函数的具体用法?PHP isAuthorized怎么用?PHP isAuthorized使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: checkAuth

 private function checkAuth($method)
 {
     $auth = "";
     if ($this->input->server('HTTP_X_AUTHORIZATION')) {
         $auth = $this->input->server('HTTP_X_AUTHORIZATION');
     }
     $request_date = "";
     if ($this->input->server('HTTP_DATE')) {
         $request_date = $this->input->server('HTTP_DATE');
     }
     $query_string = "";
     if ($this->input->server('QUERY_STRING')) {
         $query_string = $this->input->server('QUERY_STRING');
     }
     if (empty($request_date) || !$this->checkDate($request_date)) {
         $error_code = "403";
         $error_message = $error_code . " Date is invalid";
         show_error($error_message, $error_code);
         exit;
     }
     if (empty($auth) || !isAuthorized($auth, $request_date, $method, $query_string)) {
         $error_code = "401";
         $error_message = $error_code . " Unauthorized";
         show_error($error_message, $error_code);
         exit;
     }
 }
开发者ID:syfy,项目名称:REST_Service,代码行数:27,代码来源:rest_service.php

示例2: show_default

function show_default()
{
    $profiledb = ProfileDB::getInstance();
    $profiles = $profiledb->getList();
    if (is_array($profiles) == false) {
        $profiles = array();
    }
    $can_manage_profiles = isAuthorized('manageSharedFolders');
    $can_manage_configuration = isAuthorized('manageConfiguration');
    page_header();
    echo '<div id="profiles_div">';
    echo '<h1>' . _('Profiles') . '</h1>';
    echo '<div id="profiles_list_div">';
    echo '<table border="0" cellspacing="1" cellpadding="3">';
    foreach ($profiles as $profile) {
        echo '<tr>';
        echo '<td><a href="profiles.php?action=manage&amp;id=' . $profile->id . '">' . $profile->id . '</a></td>';
        if ($can_manage_profiles) {
            echo '<td><form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this profile?') . '\');">';
            echo '<input type="hidden" name="name" value="Profile" />';
            echo '<input type="hidden" name="action" value="del" />';
            echo '<input type="hidden" name="ids[]" value="' . $profile->id . '" />';
            echo '<input type="submit" value="' . _('Delete this profile') . '" />';
            echo '</form></td>';
        }
        echo '</tr>';
    }
    echo '</table>';
    echo '</div>';
    echo '</div>';
    page_footer();
    die;
}
开发者ID:skdong,项目名称:nfs-ovd,代码行数:33,代码来源:profiles.php

示例3: getMyPermissionsHash

function getMyPermissionsHash()
{
    $permissionsList = "";
    if (isAuthorized()) {
        if (isset(Reg::get('usr')->perms) and !empty(Reg::get('usr')->perms)) {
            if (is_array(Reg::get('usr')->perms->permissionsList)) {
                foreach (Reg::get('usr')->perms->permissionsList as $perm) {
                    $permissionsList .= $perm->id . ':';
                }
            }
        }
    }
    return md5($permissionsList);
}
开发者ID:Welvin,项目名称:stingle,代码行数:14,代码来源:functions.inc.php

示例4: grantAccess

function grantAccess()
{
    $MM_restrictGoTo = "index.php";
    if (!(isset($_SESSION['MM_Username']) && isAuthorized("", $MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup']))) {
        $MM_qsChar = "?";
        $MM_referrer = $_SERVER['PHP_SELF'];
        if (strpos($MM_restrictGoTo, "?")) {
            $MM_qsChar = "&";
        }
        if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) {
            $MM_referrer .= "?" . $QUERY_STRING;
        }
        $MM_restrictGoTo = $MM_restrictGoTo . $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
        header("Location: " . $MM_restrictGoTo);
        exit;
    }
}
开发者ID:seLuFerrando,项目名称:padelPrivee,代码行数:17,代码来源:functions.php

示例5: Twig_Loader_Filesystem

<?php

require_once "../subs.php";
require_once "../conf.inc.php";
require_once "../lib/dblayer.php";
require_once "./subs.php";
require_once "../vendor/autoload.php";
// Twig инициализация
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem("../templates");
// Twig папка с шаблонами
$twig = new Twig_Environment($loader, array("cache" => "../cache", "auto_reload" => 1));
// Twig no cache
$template = 'tools.twig';
if ($admin_login = isAuthorized()) {
    $c['nojs'] = true;
    $users = getUsers();
    $permissions = getPermissions($admin_login["uid"], $users);
    if ($permissions["bills"] == 'deny') {
        unset($TITLE["bills"]);
    }
    if ($permissions["users"] == 'deny') {
        unset($TITLE["users"]);
    }
    $c['dir'] = basename(__DIR__);
    $TITLE['helpdesk/reports'] = "Отчёты";
    $c['sections'] = $TITLE;
    $categories = getCategories();
    $c["cat"] = $_cat = checkRequest("cat");
    if ($_cat) {
        $c['current_cat'] = getCategory($_cat);
开发者ID:progervlad,项目名称:utils,代码行数:31,代码来源:index.php

示例6: pageClearence

 function pageClearence($secLevel, $AUTH_redirectTo)
 {
     if (!isAuthorized($secLevel)) {
         header("Location: " . $AUTH_redirectTo);
     }
 }
开发者ID:hackdracko,项目名称:Facturacion-Kio,代码行数:6,代码来源:utils.php

示例7: ini_set

<?php

/*
 * index.php
 * general page
 *
 */
ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE);
require 'subs.php';
require 'conf.inc.php';
require_once "lib/dblayer.php";
$stage = isset($_REQUEST['stage']) ? check_string($_REQUEST['stage'], 'string') : null;
// Стадия
if (isAuthorized()) {
    header("Location: home");
} else {
    //    echo 2;
    authorize();
}
if ($db_err["error_no"] != null) {
    print_r($db_err);
}
// DB-errors
开发者ID:progervlad,项目名称:utils,代码行数:24,代码来源:index.php

示例8: checkAuthorization

function checkAuthorization($policy_)
{
    if (isAuthorized($policy_)) {
        return true;
    }
    popup_error(_('You are not allowed to perform this action'));
    return false;
}
开发者ID:bloveing,项目名称:openulteo,代码行数:8,代码来源:functions.inc.php

示例9: show_default

function show_default()
{
    $tasks = $_SESSION['service']->tasks_list();
    if (is_null($tasks)) {
        popup_error(_('Internal error requestings tasks'));
        redirect();
    }
    $servers_ = $_SESSION['service']->getOnlineServersList();
    if (is_null($servers_)) {
        $servers_ = array();
    }
    $servers = array();
    foreach ($servers_ as $server) {
        if (isset($server->ulteo_system) && $server->ulteo_system == 1) {
            $servers[] = $server;
        }
    }
    $can_do_action = isAuthorized('manageServers');
    page_header();
    echo '<div id="tasks_div">';
    echo '<h1>' . _('Tasks') . '</h1>';
    if (count($tasks) > 0) {
        echo '<div id="tasks_list_div">';
        echo '<h2>' . _('List of tasks') . '</h2>';
        echo '<table class="main_sub sortable" id="tasks_list_table" border="0" cellspacing="1" cellpadding="5">';
        echo '<thead>';
        echo '<tr class="title">';
        echo '<th>' . _('ID') . '</th>';
        echo '<th>' . _('Creation time') . '</th>';
        echo '<th>' . _('Type') . '</th>';
        echo '<th>' . _('Server') . '</th>';
        echo '<th>' . _('Status') . '</th>';
        echo '<th>' . _('Details') . '</th>';
        echo '</tr>';
        echo '</thead>';
        echo '<tbody>';
        $count = 0;
        foreach ($tasks as $task) {
            $content = 'content' . ($count++ % 2 == 0 ? 1 : 2);
            if (array_key_exists($task->server, $servers_)) {
                $server_name = $servers_[$task->server]->getDisplayName();
            } else {
                $server_name = $task->server;
            }
            $can_remove = $task->succeed() || $task->failed();
            if ($task->succeed()) {
                $status = '<span class="msg_ok">' . _('Finished') . '</span>';
            } elseif ($task->failed()) {
                $status = '<span class="msg_error">' . _('Error') . '</span>';
            } elseif ($task->status == 'in progress') {
                $status = '<span class="msg_warn">' . _('In progress') . '</span>';
            } else {
                $status = $task->status;
            }
            echo '<tr class="' . $content . '">';
            echo '<td><a href="?action=manage&id=' . $task->id . '">' . $task->id . '</a></td>';
            echo '<td>' . date('Y-m-d H:i:s', $task->t_begin) . '</td>';
            echo '<td>' . $task->getAttribute('type') . '</td>';
            echo '<td><a href="servers.php?action=manage&id=' . $task->server . '">' . $server_name . '</a></td>';
            echo '<td>' . $status . '</td>';
            echo '<td>' . $task->getAttribute('request') . '</td>';
            // todo !!!
            if ($can_do_action) {
                echo '<td>';
                if ($can_remove) {
                    echo '<form action="actions.php" method="post">';
                    echo '<input type="hidden" name="name" value="Task" />';
                    echo '<input type="hidden" name="action" value="del" />';
                    echo '<input type="hidden" name="checked_tasks[]" value="' . $task->id . '" />';
                    echo '<input type="submit" value="' . _('Delete') . '" />';
                    echo '</form>';
                }
                echo '</td>';
            }
            echo '</tr>';
        }
        echo '</tbody>';
        echo '</table>';
        echo '</div>';
    }
    $can_do_action = False;
    if (count($servers) > 0 && $can_do_action) {
        echo '<h2>' . _('Install an application from a package name') . '</h2>';
        echo '<form action="actions.php" method="post">';
        echo '<input type="hidden" name="name" value="Task" />';
        echo '<input type="hidden" name="action" value="add" />';
        echo '<select name="server">';
        foreach ($servers as $server) {
            echo '<option value="' . $server->id . '">' . $server->getDisplayName() . '</option>';
        }
        echo '</select> &nbsp; ';
        echo '<input type="text" name="request" value="" /> &nbsp; ';
        echo '<input type="hidden" name="type" value="install_from_line" />';
        echo '<input type="submit" name="submit" value="' . _('Install') . '" />';
        echo '</form>';
        echo '<h2>' . _('Upgrade the internal system and applications') . '</h2>';
        echo '<form action="actions.php" method="post">';
        echo '<input type="hidden" name="name" value="Task" />';
        echo '<input type="hidden" name="action" value="add" />';
        echo '<input type="hidden" name="type" value="upgrade" />';
//.........这里部分代码省略.........
开发者ID:bloveing,项目名称:openulteo,代码行数:101,代码来源:tasks.php

示例10: footer_static

            footer_static();
        }
    } else {
        // conf not valid
        if ($setup) {
            popup_error('Error : ' . $ret);
            redirect('configuration.php?action=init');
        } else {
            header_static(_('Configuration'));
            echo '<p class="msg_error centered">' . $ret . '</p>';
            print_prefs($prefs);
            footer_static();
        }
    }
} else {
    $can_manage_configuration = isAuthorized('manageConfiguration');
    if (isset($_GET['action']) && $_GET['action'] == 'init') {
        try {
            $prefs = new Preferences_admin();
        } catch (Exception $e) {
        }
        $prefs->initialize();
        require_once dirname(__FILE__) . '/includes/page_template.php';
        page_header();
        // printing of preferences
        if ($can_manage_configuration) {
            echo '<form method="post" action="configuration.php">';
            echo '<input type="hidden" name="setup" value="setup" />';
        }
        print_prefs5($prefs, 'general', 'sql');
        if ($can_manage_configuration) {
开发者ID:skdong,项目名称:nfs-ovd,代码行数:31,代码来源:configuration.php

示例11:

                      <td>&nbsp;</td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr>
                      <td><div align="right">Observaciones:</div></td>
                      <td><label>
                        <textarea name="observaciones" cols="50" rows="5" id="observaciones"></textarea>
                      </label></td>
                      <td>&nbsp;</td>
                    </tr>
                    <?php 
if ($row_empleado['idunidadnegocio'] == $TYE_UNIDADNEGOCIO_DANONE || isAuthorized($FWK_PRIV_CONFIGURACION)) {
    ?>
							<tr>
                              <td><div align="right">Refacturar:</div></td>

								<td><select name="refacturar" id="refacturar">
                          <option value="0" selected>No refacturar</option>
                          <option value="4">Bonafont Themis</option>
						  <option value="5">Bonafont Training</option>
						  <option value="6">Bonafont IT</option>
						  <option value="7">Bonafont Compensaciones</option>
                          <option value="1">Colombia</option>
                          <option value="2">Guatemala</option>
                          <option value="3">El Salvador</option>
                        </select>                             </td>
                              <td>&nbsp;</td>
开发者ID:hackdracko,项目名称:envasadoras,代码行数:31,代码来源:comprobacion_tc.php

示例12: header

//防止直接登入
if (!$_SESSION['MM_Username'] || !$_SESSION['MM_UserGroup']) {
    header("Location: " . $MM_redirectLoginFailed1);
}
//防止管理员进入
function isAuthorized($UserName, $UserGroup)
{
    $isValid = False;
    if (!empty($UserGroup)) {
        if ($UserGroup['authority'] == 1) {
            $isValid = true;
        }
    }
    return $isValid;
}
if (isAuthorized($_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])) {
    header("Location: " . $MM_redirectLoginFailed2);
}
//get data from the database of user's informaiton
$id_quest = sprintf("SELECT id,username FROM admin  WHERE username='" . $_SESSION['MM_Username'] . "' AND password='" . $_SESSION['MM_UserGroup']['password'] . "'");
$id_set = mysqli_query($connect, $id_quest) or die(mysql_error());
$id = mysqli_fetch_assoc($id_set);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0047)http://thechoose.phpnet.us/hushi2014070801.html -->
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=GBK">

<title>教育交流协会</title>
<meta name="keywords" content="个人留学直通车,中日人才交流援助平台,出国,留学,留日,人才交流,援助平台,培训,IPA,对外汉语">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<meta name="description" content="个人留学直通车,中日人才交流援助平台,出国,留学,留日,人才交流,援助平台,培训,IPA">
开发者ID:jaean1993,项目名称:education_website,代码行数:31,代码来源:newfang_userhome.php

示例13: Explode

        $arrGroups = Explode(",", $strGroups);
        if (in_array($UserName, $arrUsers)) {
            $isValid = true;
        }
        // Or, you may restrict access to only certain users based on their username.
        if (in_array($UserGroup, $arrGroups)) {
            $isValid = true;
        }
        if ($strUsers == "" && true) {
            $isValid = true;
        }
    }
    return $isValid;
}
$MM_restrictGoTo = "../index.php?error=2";
if (!(isset($_SESSION['MM_arica']) && isAuthorized("5,4,2", $MM_authorizedUsers, $_SESSION['MM_arica'], $_SESSION['MM_UserGroup']))) {
    $MM_qsChar = "?";
    $MM_referrer = $_SERVER['PHP_SELF'];
    if (strpos($MM_restrictGoTo, "?")) {
        $MM_qsChar = "&";
    }
    if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) {
        $MM_referrer .= "?" . $QUERY_STRING;
    }
    $MM_restrictGoTo = $MM_restrictGoTo . $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
    header("Location: " . $MM_restrictGoTo);
    exit;
}
?>

<?php 
开发者ID:sebasotelo,项目名称:Arica.cl,代码行数:31,代码来源:index.php

示例14: isAuthorizedW

 public function isAuthorizedW($user)
 {
     // All registered users can add posts
     if ($this->action === 'add' || $this->action === 'index' || $this->action === 'dashboard_user') {
         return true;
     }
     // The owner of a post can edit and delete it
     if (in_array($this->action, array('edit', 'delete'))) {
         $postId = (int) $this->request->params['pass'][0];
         if ($this->Wallet->isOwnedBy($postId, $user['id'])) {
             return true;
         }
     }
     return isAuthorized($user);
 }
开发者ID:yenchuchu,项目名称:MoneyLover,代码行数:15,代码来源:WalletsController.php

示例15: isAuthorized

<?php

function isAuthorized()
{
    return isset($_SESSION['userId']);
}
function getUserData($id = null, Mysql $mysql)
{
    $user = ['companyId' => 0, 'companyPrivs' => 0];
    if (!$id) {
        return $user;
    }
    $query = $mysql->mq('
								SELECT
									`companyId`,
									`companyPrivs`
								FROM
									`company`
								WHERE 
									`companyId` = ' . (int) $id . '
								LIMIT 1
									
						');
    return $mysql->assoc($query);
}
$userInfo = getUserData(isAuthorized() ? $_SESSION['userId'] : null, $mysql);
开发者ID:Zzepish,项目名称:CMS-for-phone,代码行数:26,代码来源:authorizationAjax.php


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