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


PHP ensure_permission函数代码示例

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


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

示例1: ensure_permission

<?php

include '../../config.php';
ensure_permission('admin');
ensure_role('admin');
if (isset($_REQUEST['submit'])) {
    $id = $_REQUEST['id'];
    $username = $_REQUEST['username'];
    $password1 = $_REQUEST['password1'];
    $password2 = $_REQUEST['password2'];
    $phone = $_REQUEST['phone'];
    $role = $_REQUEST['role'];
    @($permission = implode(',', $_POST['permission']));
    if ($role == '') {
        $err = "You must choose at least 1 <b>User type</b>.";
    }
    if ($permission == '') {
        $err = "You must choose at least 1 <b>Permission</b>.";
    }
    if ($phone == '') {
        $err = "<b>Phone</b> can't blank";
    }
    if ($password1 != '' || $password2 != '') {
        if ($password1 != $password2) {
            $err = "<b>Password</b> does not match";
        }
        if (strlen($password1) < 5) {
            $err = "<b>Password</b> must be greater than 6 letters";
        }
    }
    $rown = $db->getone("SELECT count(*) FROM `users` WHERE `username` = '{$username}' AND id<>{$id}");
开发者ID:LAOSChool,项目名称:Web,代码行数:31,代码来源:admin_user_edit.php

示例2: ensure_permission

<?php

include '../../config.php';
ensure_permission('ivr');
//ensure_role('mod,sadmin,admin');
$id = $_REQUEST['id'];
$res = $db->query("select * from `ivr` where id={$id}");
$res->fetchInto($dt);
$music = "{$dirfile}/contents/ivr/{$dt['content']}";
?>

<?php 
echo <<<EOT
\t\t <table class="table table-hover">
\t\t\t<thead> 
\t\t\t\t<tr> 
\t\t\t\t\t<th><b>{$dt['name']}</b></th>
\t\t\t\t</tr> 
\t\t\t</thead> 
\t\t\t<tbody> 
\t\t\t<tr>
\t\t\t\t<td align=center>
\t\t\t\t\t<center>
\t\t\t\t\t\t<audio controls autoplay preload='auto' id='html5player'>
\t\t\t\t\t\t\t<source src="{$music}" type="audio/mpeg">
\t\t\t\t\t\t\tYour browser do not support HTML5
\t\t\t\t\t\t</audio>
\t\t\t\t\t\t<p><a class='btn btn-mini btn-info' onclick='alert("Right click and choose Save link as...");return false' href="{$music}"><i class="icon-download-alt"></i> Download this sound</a></p>
\t\t\t\t\t</center>
\t\t\t\t</td>
\t\t\t</tr>
开发者ID:LAOSChool,项目名称:Web,代码行数:31,代码来源:ivr_tree_popmusic.php

示例3: ensure_permission

<?php

include '../../config.php';
ensure_permission('atd');
ensure_role('mod,sadmin,admin');
$type = $_REQUEST['type'];
$time = time();
?>
<div class="bs-docs-example">
	<div class="navbar navbar-static">
		<div class="navbar-inner">
			<div style="width: auto;" class="container">
				<a href="javascript:;" class="brand"><?php 
lang('atdmanager');
?>
</a>
				<ul class="nav">
					<li <?php 
echo $type == 'search' || $type == '' ? "class='active'" : "";
?>
><a href="javascript:;" class='formchange' form="search"><i class="icon-search"></i> <?php 
lang('search');
?>
</a></li>
					<li><a href="javascript:;" id='loadform'></a></li>
				</ul>
			</div>
		</div>
	</div>
</div>
开发者ID:LAOSChool,项目名称:Web,代码行数:30,代码来源:atd_manager_form.php

示例4: ensure_permission

<?php

include '../../config.php';
ensure_permission('rnk');
ensure_role('mod,sadmin,admin');
$type = $_REQUEST['type'];
$time = time();
?>
<div class="bs-docs-example">
	<div class="navbar navbar-static">
		<div class="navbar-inner">
			<div style="width: auto;" class="container">
				<a href="javascript:;" class="brand"><?php 
lang('rnkview');
?>
</a>
				<ul class="nav">
					<li><a href="javascript:;" id='loadform'></a></li>
				</ul>
			</div>
		</div>
	</div>
</div>

<?php 
if ($type == 'search' || $type == '') {
    ?>

	<form method=POST  id='searchform' class="form-horizontal" action='includes/rnk/rnk_view_db.php?lang=<?php 
    echo $lang;
    ?>
开发者ID:LAOSChool,项目名称:Web,代码行数:31,代码来源:rnk_view_form.php

示例5: ensure_permission

<?php

include '../../config.php';
ensure_permission('inf');
ensure_role('mod,sadmin,admin');
$type = $_REQUEST['type'];
$time = time();
$headers = array();
$auth_key = $_SESSION[$config_session]['auth_key'];
$headers[] = "auth_key: {$auth_key}";
$headers[] = "api_key: TEST_API_KEY";
$userdata = callapi($headers, '', '', 'api/users/myprofile');
$userdatas = explode("\n", $userdata['output']);
$myprofile = json_decode(end($userdatas));
$infdata = callapi($headers, '', '', "api/schools/{$myprofile->school_id}");
$infdatas = explode("\n", $infdata['output']);
$schooldata = json_decode(end($infdatas));
//print_r($schooldata);
$prvdata = callapi($headers, '', '', "api/sys/sys_province");
$prvdatas = explode("\n", $prvdata['output']);
$provincedata = json_decode(end($prvdatas));
$dgrdata = callapi($headers, '', '', "api/sys/sys_degree");
$dgrdatas = explode("\n", $dgrdata['output']);
$degreedata = json_decode(end($dgrdatas));
$disdata = callapi($headers, '', '', "api/sys/sys_dist");
$disdatas = explode("\n", $disdata['output']);
$distdata = json_decode(end($disdatas));
//print_r($distdata);
?>
<div class="bs-docs-example">
	<div class="navbar navbar-static">
开发者ID:LAOSChool,项目名称:Web,代码行数:31,代码来源:inf_manager_form.php

示例6: ensure_permission

<?php

include "../../config.php";
ensure_permission('cls');
ensure_role('mod,sadmin,admin');
$page = $_REQUEST['page'];
$limit = $_REQUEST['limit'];
if ($limit == '') {
    $limit = 20;
}
if ($page == '') {
    $page = 1;
}
$pages = ($page - 1) * $limit;
$requestparam .= "";
foreach ($_REQUEST as $key => $value) {
    $requestparam .= "{$key}={$value}&";
}
$requestparam = substr($requestparam, 0, -1);
for ($i = 5; $i <= 51; $i = $i * 2) {
    if ($i == $limit) {
        $sss = "selected";
    } else {
        $sss = "";
    }
    $slt .= "<option {$sss} value='{$i}'>{$i}</option> \n";
}
$auth_key = $_SESSION[$config_session]['auth_key'];
$headers = array();
$headers[] = "auth_key: {$auth_key}";
$headers[] = "api_key: TEST_API_KEY";
开发者ID:LAOSChool,项目名称:Web,代码行数:31,代码来源:cls_manager_db.php

示例7: ensure_permission

<?php

include "../../config.php";
//die("err");
ensure_permission('usr');
ensure_role('mod,sadmin,admin');
$headers = array();
$auth_key = $_SESSION[$config_session]['auth_key'];
$headers[] = "auth_key: {$auth_key}";
$headers[] = "api_key: TEST_API_KEY";
$headers[] = "Content-Type: application/json";
$userdata = callapi($headers, '', '', 'api/users/myprofile');
$userdatas = explode("\n", $userdata['output']);
$myprofile = json_decode(end($userdatas));
$err = '';
$class_id = $_REQUEST['class_id'];
$uploadedfile = $_REQUEST['uploadedfile'];
$err = '';
foreach ($_REQUEST as $key => $r) {
    if ($key == 'submit') {
        continue;
    }
    if ($key == 'cls_level' || $key == 'std_parent_name' || $key == 'std_contact_name' || $key == 'sso_id') {
        continue;
    }
    if ($r == '') {
        $err = "{$lang_pleasefill} {$key}";
    }
}
if ($err == "") {
    $headers = array();
开发者ID:LAOSChool,项目名称:Web,代码行数:31,代码来源:usr_manager_import.php

示例8: ensure_permission

<?php

include "../../config.php";
//die("err");
ensure_permission('mtb');
ensure_role('mod,sadmin,admin');
$headers = array();
$auth_key = $_SESSION[$config_session]['auth_key'];
$headers[] = "auth_key: {$auth_key}";
$headers[] = "api_key: TEST_API_KEY";
$headers[] = "Content-Type: application/json";
$userdata = callapi($headers, '', '', 'api/users/myprofile');
$userdatas = explode("\n", $userdata['output']);
$myprofile = json_decode(end($userdatas));
$err = '';
$arr['id'] = $_REQUEST['id'];
$arr['school_id'] = $myprofile->school_id;
$arr['years'] = $_REQUEST['years'];
$arr['from_year'] = $_REQUEST['from_year'];
$arr['to_year'] = $_REQUEST['to_year'];
$arr['term_num'] = 2;
$arr['term_duration'] = 4;
$arr['start_dt'] = "{$arr['from_year']}-09-05 00:00:00";
$djson = json_encode($arr);
//echo "<textarea>$djson</textarea>";
if ($err == "") {
    $posts = $djson;
    $sendapi = callapi($headers, $posts, '', "api/schools/years/update");
    $sendapidatas = explode("\n", $sendapi['output']);
    $sendapidata = json_decode(end($sendapidatas));
    //print_r($sendapi);
开发者ID:LAOSChool,项目名称:Web,代码行数:31,代码来源:mtb_scy_edit.php

示例9: ensure_permission

<?php

include "../../config.php";
ensure_permission('ttb');
ensure_role('mod,sadmin,admin');
$djson = $_REQUEST['djson'];
$ddjson = json_decode($djson);
$m1 = "m" . $ddjson->filter_exam_month;
$m = json_decode($ddjson->{$m1});
$err = '';
if (!is_numeric($m->sresult) || $m->sresult > 10) {
    $err = "Result must is number and <10";
}
if ($err == "") {
    $headers = array();
    $auth_key = $_SESSION[$config_session]['auth_key'];
    $headers[] = "auth_key: {$auth_key}";
    $headers[] = "api_key: TEST_API_KEY";
    $headers[] = "Content-Type: application/json";
    $posts = $djson;
    //$posts = '{"id":2,"school_id":1,"class_id":1,"exam_id":null,"exam_name":null,"exam_type":1,"exam_dt":null,"subject_id":2,"teacher_id":null,"student_id":14,"student_name":"Student 14","notice":"Normal exam","sresult":"1","term_id":1,"exam_month":9,"exam_year":2016,"term_val":null,"sch_year_id":0,"subject":"Ly","teacher":null,"term":"HK 1"}';
    $sendapi = callapi($headers, $posts, '', 'api/exam_results/input');
    //print_r($sendapi);
    if ($sendapi['http_code'] != 200) {
        $status[] = $sendapi['http_code'];
    }
    if (count($status) > 0) {
        $statu = implode(', ', $status);
        echo "<span class='label label-important'>\n\t\t\t\t\t<i class='icon-bug'></i> {$lang_error}: {$statu}\n\t\t\t\t</span>";
    } else {
        $statu = "OKIE";
开发者ID:LAOSChool,项目名称:Web,代码行数:31,代码来源:ttb_manager_send.php

示例10: ensure_permission

<?php

include '../../config.php';
ensure_permission('pnt');
ensure_role('mod,sadmin,admin');
$type = $_REQUEST['type'];
$time = time();
?>
<div class="bs-docs-example">
	<div class="navbar navbar-static">
		<div class="navbar-inner">
			<div style="width: auto;" class="container">
				<a href="javascript:;" class="brand"><?php 
lang('exresult');
?>
</a>
				<ul class="nav">
					<li <?php 
echo $type == 'search' || $type == '' ? "class='active'" : "";
?>
><a href="javascript:;" class='formchange' form="search"><i class="icon-search"></i> Search</a></li>
					<li><a href="javascript:;" id='loadform'></a></li>
				</ul>
			</div>
		</div>
	</div>
</div>

<?php 
if ($type == 'search' || $type == '') {
    ?>
开发者ID:LAOSChool,项目名称:Web,代码行数:31,代码来源:pnt_manager_form.php

示例11: ensure_permission

<?php

include "../../config.php";
ensure_permission('ntf');
ensure_role('mod,sadmin,admin');
$page = $_REQUEST['page'];
$limit = $_REQUEST['limit'];
if ($limit == '') {
    $limit = 20;
}
if ($page == '') {
    $page = 1;
}
$pages = ($page - 1) * $limit;
$filter_to_dt = $_REQUEST['filter_to_dt'];
$filter_from_dt = $_REQUEST['filter_from_dt'];
$requestparam .= "";
foreach ($_REQUEST as $key => $value) {
    $requestparam .= "{$key}={$value}&";
}
$requestparam = substr($requestparam, 0, -1);
for ($i = 5; $i <= 51; $i = $i * 2) {
    if ($i == $limit) {
        $sss = "selected";
    } else {
        $sss = "";
    }
    $slt .= "<option {$sss} value='{$i}'>{$i}</option> \n";
}
$auth_key = $_SESSION[$config_session]['auth_key'];
$headers = array();
开发者ID:LAOSChool,项目名称:Web,代码行数:31,代码来源:ntf_manager_db.php

示例12: ensure_permission

<?php

include "../../config.php";
ensure_permission('weblog');
$requestparam .= "";
foreach ($_REQUEST as $key => $value) {
    $requestparam .= "{$key}={$value}&";
}
// Get condition
$username = $_REQUEST['username'];
$description = $_REQUEST['description'];
// Get date
$startdate = $_REQUEST['startdate'];
$enddate = $_REQUEST['enddate'];
if ($startdate == "From") {
    $startdate = "";
}
if ($enddate == "To") {
    $enddate = "";
}
$page = $_REQUEST['page'];
$limit = $_REQUEST['limit'];
if ($limit == '') {
    $limit = 20;
}
if ($page == '') {
    $page = 1;
}
$pages = ($page - 1) * $limit;
//username Query
if ($username != "") {
开发者ID:LAOSChool,项目名称:Web,代码行数:31,代码来源:weblog_history_db.php


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