本文整理汇总了PHP中check_level函数的典型用法代码示例。如果您正苦于以下问题:PHP check_level函数的具体用法?PHP check_level怎么用?PHP check_level使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_level函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: m__set_level
function m__set_level()
{
global $dbm;
$_POST = helper::sqlxss($_POST);
$aid = isset($_POST['aid']) ? intval($_POST['aid']) : 0;
$gid = isset($_POST['gid']) ? intval($_POST['gid']) : 0;
$_POST['level'] = isset($_POST['level']) ? $_POST['level'] : array();
if ($aid < 0 && $gid < 0) {
die('{"code":"1","msg":"请选择权限设置对象,无法设置"}');
}
if ($gid > 0) {
if ($gid == 1) {
die('{"code":"100","msg":"超级管理组权限无需设置"}');
}
check_level("B0301");
$fields['g_urank'] = implode(',', $_POST['level']);
$rs = $dbm->single_update(TB_PREFIX . 'admin_group', $fields, "group_id='{$gid}'");
logs("设置组权限成功:" . $fields['g_urank']);
die('{"code":"0","msg":"设置用户组权限成功"}');
}
if ($aid > 0) {
check_level("B0302");
//die(print_r($_POST));
$fields['alevel'] = implode(',', $_POST['level']);
$rs = $dbm->single_update(TB_PREFIX . 'admin_list', $fields, "admin_id='{$aid}'");
logs("设置组权限成功:" . $fields['alevel']);
die('{"code":"0","msg":"设置用户权限成功"}');
}
}
示例2: m__save
function m__save()
{
global $l_obj;
check_level("A0201");
// 其他站点配置
$config = $_SERVER['DOCUMENT_ROOT'] . SITE_PATH . '/core/config.php';
$cf = @file_get_contents($config);
if (!$cf) {
die('{"code":"0","msg":"读取失败"}');
}
if (!empty($_POST)) {
foreach ($_POST as $k => $v) {
$v = urldecode($v);
if (get_magic_quotes_gpc()) {
$v = stripslashes($v);
}
if ($k == 'comment_code') {
} else {
$v = preg_replace('~"~', '"', $v);
}
$v = preg_replace('~"~', '\\\\"', $v);
set_config(strtoupper($k), $v, $cf);
}
}
$cf = @file_put_contents($config, $cf);
if (!$cf) {
die('{"code":"0","msg":"写入失败"}');
}
//$c->url_config();
//$c->update_cate();
//$c->update_externs();
$l_obj->insert("修改配置成功");
die('{"code":"100","msg":"配置成功"}');
}
示例3: createmenuitems
function createmenuitems()
{
global $PAGESACCESS;
// $menubar['id'] = array("href" => , "label" => );
$menubar['main'] = array("href" => "./", "label" => T_("Status"));
$menubar['users'] = array("href" => "display", "label" => T_("Users"), "submenu" => array('createuser' => array("href" => "newuser", "label" => T_("New User")), 'createtickets' => array("href" => "newtickets", "label" => T_("Batch Users")), 'createmachine' => array("href" => "newuser?computer", "label" => T_("Computer Account"))));
$menubar['sessions'] = array("href" => "sessions", "label" => T_("Monitor Sessions"), "submenu" => array('reports' => array("href" => "reports", "label" => T_("Reports")), 'dhcpleases' => array("href" => "dhcpleases", "label" => T_("DHCP Leases"))));
$menubar['settings'] = array("href" => "settings", "label" => T_("Settings"), "submenu" => array('uploadlogo' => array("href" => "uploadlogo", "label" => T_("Site Logo")), 'netconfig' => array("href" => "netconfig", "label" => T_("Network Settings")), 'chilliconfig' => array("href" => "chilliconfig", "label" => T_("Coova Chilli Settings")), 'loginconfig' => array("href" => "loginconfig", "label" => T_("Portal Customisation")), 'ticketprintconfig' => array("href" => "ticketprintconfig.php", "label" => T_("Ticket Print Settings")), 'groups' => array("href" => "groupconfig", "label" => T_("Groups"))));
$menubar['passwd'] = array("href" => "passwd", "label" => T_("Admin Users"), "submenu" => array('adminlog' => array("href" => "adminlog", "label" => T_("Admin Log"))));
$menubar['logout'] = array("href" => "./?logoff", "label" => T_("Logoff"));
// Filter out menu items user doesn't have access to
$newmenubar = array();
foreach ($menubar as $label => $toplevel) {
// If they don't have access to top level of a menu section, they also don't have access to the levels below it via the menu (still up to the PAGESACCESS to prevent access
if (check_level($PAGESACCESS[$label])) {
$submenu = array();
if (isset($toplevel['submenu']) && is_array($toplevel['submenu'])) {
foreach ($toplevel['submenu'] as $secondlabel => $secondlevel) {
if (check_level($PAGESACCESS[$secondlabel])) {
$submenu[$secondlabel] = $secondlevel;
}
}
}
$item = $toplevel;
unset($item['submenu']);
if (sizeof($submenu)) {
$item['submenu'] = $submenu;
}
$newmenubar[$label] = $item;
}
}
return $newmenubar;
}
示例4: m__del
/**
* 删除选中的数据
* 支持单个删除 根据post数据来获取需要删除的数据的信息
*/
function m__del()
{
global $dbm;
//判断操作权限
check_level("E08");
if (isset($_POST['resource_id'])) {
$_POST['params'][] = $_POST['resource_id'];
}
//循环删除
foreach ($_POST['params'] as $id) {
$id = intval($id);
$res = $dbm->query("SELECT id,info_id,resource_url from " . TB_PREFIX . "resource_list WHERE id='" . $id . "'");
if (count($res['list']) != 1) {
continue;
}
$res = check_resource($res['list'][0]['id'], $res['list'][0]['info_id'], $res['list'][0]['resource_url']);
if ($res['info']['table_name'] != 'undefined' || $res['info']['id_name'] != 'undefined' || $res['info']['id_zhi'] != 'undefined') {
continue;
}
$img_path = str_replace('\\', '/', dirname(__FILE__)) . '/..' . $res['info']['resource_url'];
@unlink($img_path);
$x = strripos($img_path, '/');
$thumb_img = substr($img_path, 0, $x + 1) . "thumb_" . substr($img_path, $x + 1);
@unlink($thumb_img);
@rmdir(dirname($thumb_img));
$where = " id = '" . $id . "'";
$res = $dbm->single_del(TB_PREFIX . "resource_list", $where);
if (!empty($res['error'])) {
continue;
}
}
logs("删除资源成功");
die('{"code":"0","msg":"删除成功"}');
}
示例5: check_page_access
function check_page_access()
{
global $ACCESS_LEVEL, $templateEngine;
if (!check_level($ACCESS_LEVEL)) {
$templateEngine->displayPage('accessdenied.tpl');
exit;
}
}
示例6: m__edit
function m__edit()
{
global $url_re_obj, $logs_obj;
check_level("A0301");
$post = $_POST;
//解码数据
foreach ($post as $key => $val) {
$post[$key] = urldecode($val);
}
if (!is_numeric($post['url_id'])) {
die('{"code":"210","msg":"规则节点ID必须是数字"}');
}
if (empty($post['url_title'])) {
die('{"code":"220","msg":"规则节点名称不能为空"}');
}
if (!preg_match('~^[A-Za-z][A-Za-z]*[a-z0-9_]*$~', $post['url_title'])) {
die('{"code":"230","msg":"规则节点名称必须以字母开头,只允许字母、下划线"}');
}
if (empty($post['url_true'])) {
die('{"code":"230","msg":"动态地址规则不能为空"}');
}
if (empty($post['url_rule'])) {
die('{"code":"230","msg":"伪静态地址规则不能为空"}');
}
if ($post['url_id'] > 0) {
// 编辑
$res = $url_re_obj->update($post, $post['url_id']);
//更新缓存
//$c -> update_url_config();
//$c -> update_cate();
//生成伪静态文件(.htaccess)
//htaccess();
//iis_httpd_ini();
$logs_obj->insert("更新伪静态成功");
if ($res) {
die('{"code":"0","msg":"更新规则成功"}');
}
die('{"code":"240","msg":"更新规则失败"}');
} else {
// 添加
//判断节点是否存在
/*$rs=$dbm->query("select * from ".TB_PREFIX . "url_rewrite where url_title='{$_POST['url_title']}'");
if(count($rs['list'])>0) die('{"code":"100","msg":"'.$_POST['url_title'].'节点名称不能重复"}');
unset($_POST['url_id']);
$res = $dbm -> single_insert(TB_PREFIX . "url_rewrite", $_POST);*/
//更新缓存
$c->update_url_config();
$c->update_cate();
//生成伪静态文件(.htaccess)
htaccess();
iis_httpd_ini();
if (empty($res['error']) && $res['autoid'] > 0) {
die('{"code":"0","msg":"添加规则成功"}');
}
die('{"code":"250","msg":"添加规则失败,请核对重试"}');
}
}
示例7: del
public function del()
{
check_login();
check_level(3);
$del_id = I("get.del_id", '', 'number_int');
$data['comment_content'] = "我们要做个爱国的文明人哦~大家来争当爱国小能手吧O(∩_∩)O哈哈~";
if ($del_id) {
D('scomment')->where('comment_id=' . $del_id)->save($data);
$this->success('屏蔽成功', 'index.php?s=Home/comment/index');
} else {
$this->error('非法操作!');
}
}
示例8: del
public function del()
{
check_login();
check_level(3);
$del_id = I("get.del_id", '', 'number_int');
if ($del_id) {
$data['use_time'] = "90";
D('rank')->where('id=' . $del_id)->save($data);
$this->success('废除成功', 'index.php?s=Home/rank/index');
} else {
$this->error('非法操作!');
}
}
示例9: m__edit
/**
* 获取编辑或添加管理组
*/
function m__edit()
{
global $dbm;
check_level("B0101");
$params = array();
foreach ($_POST as $k => $v) {
$_POST[$k] = helper::escape($v, 1);
}
if (!is_numeric($_POST['group_id'])) {
die('{"code":"210","msg":"用户组ID必须是数字"}');
}
// 验证会员信息是否合法
if (empty($_POST['g_name'])) {
die('{"code":"220","msg":"用户组名字不能为空"}');
}
//if(!isset($_POST['g_urank']) || trim($_POST['g_urank']) =='') die('{"code":"230","msg":"用户组权限不能为空"}');
//if (!preg_match('~^[A-Za-z][A-Za-z]*[a-z0-9_]*$~', $_POST['g_name'])) die('{"code":"230","msg":"用户组名必须以字母开头,只允许字母、数字、下划线"}');
$params['g_name'] = $_POST['g_name'];
//$params['g_urank'] = $_POST['g_urank'];
$params['g_remark'] = isset($_POST['g_remark']) && !empty($_POST['g_remark']) ? htmlspecialchars($_POST['g_remark']) : '';
$params['create_time'] = time();
if (intval($_POST['group_id']) > 0) {
$where = " group_id ='" . $_POST['group_id'] . "'";
$res = $dbm->single_update(TB_PREFIX . "admin_group", $params, $where);
if (empty($res['error'])) {
logs("用户组编辑成功,用户组ID为:{$_POST['group_id']}");
die('{"code":"0","msg":"操作成功"}');
}
logs("编辑用户组失败,请核实后再添加,用户组ID为:{$_POST['group_id']}");
die('{"code":"280","msg":"编辑用户组失败,请核实后再添加"}');
} else {
// 添加会员
$where = " g_name='" . $_POST['g_name'] . "'";
$a = $dbm->single_query(array('where' => $where, 'table_name' => TB_PREFIX . "admin_group"));
if (count($a['list']) > 0) {
die('{"code":"260","msg":"用户组名字不能重复"}');
}
$res = $dbm->single_insert(TB_PREFIX . "admin_group", $params);
if ($res['autoid'] > 0) {
logs("添加用户组成功,用户组名字为:{$_POST['g_name']}");
die('{"code":"0","msg":"添加用户组成功"}');
}
logs("添加用户组失败,请核实后再添加,用户组名字为:{$_POST['g_name']}");
die('{"code":"270","msg":"添加用户组失败,请核实后再添加"}');
}
}
示例10: m__set_auth
function m__set_auth()
{
check_level("A0501");
$config = '../core/config.php';
$cf = file_get_contents($config);
$_POST = helper::sqlxss($_POST);
$code = isset($_POST['auth']) ? $_POST['auth'] : '';
if (!preg_match('~^[a-z_A-Z0-9=]{1,64}~', $code)) {
die('{"code":"1","msg":"授权码格式错误' . $code . '"}');
}
if (AUTH_CODE != $code) {
set_config('AUTH_CODE', $code, $cf);
if (helper::getChmod($config) != '0777') {
die('{"code":"1","msg":"/core/config.php 配置文件没有写权限"}');
}
file_put_contents($config, $cf);
}
die('{"code":"0","msg":"成功设置授权码"}');
}
示例11: m__edit_group
function m__edit_group()
{
global $page, $dbm;
check_level("E1004");
if ($_POST['act'] == 'search') {
$sql = "select * from " . TB_PREFIX . "keyword";
$rs = $dbm->query($sql);
$group = array();
$id = array();
foreach ($rs['list'] as $k => $v) {
if (!in_array($v['qgroup'], $group)) {
$group[$k] = $v['qgroup'];
}
$group_ = array_flip($group);
if (!empty($id[$group_[$v['qgroup']]])) {
$id[$group_[$v['qgroup']]] .= ',' . $v['keyword_id'];
} else {
$id[$group_[$v['qgroup']]] = $v['keyword_id'];
}
}
$str = '<tr><td width="50%">组名</td><td class="alignleft" width="30%">关键字数</td><td class="alignleft"></td></tr>';
foreach ($group as $k => $v) {
$id_shu = count(explode(',', $id[$k]));
$str .= '<tr><td width="80"><input title="' . $id[$k] . '" type="text" value="' . $v . '" name="qgroup" id="qgroup' . $k . '" class="ipt" ></td><td>' . $id_shu . '</td><td><a href="javascript:void(0);" class="but2 but2" id="subtn" onclick="del_group(' . $k . ')">保存</a></td></tr>';
}
die(urlencode($str));
} elseif ($_POST['act'] == 'save') {
$sql = "UPDATE " . TB_PREFIX . "keyword SET qgroup = '" . $_POST['v'] . "' WHERE keyword_id in(" . $_POST['k'] . ")";
$rs = $dbm->query_update($sql);
if (!$rs['error']) {
die("{'code':'0','msg':'保存成功'}");
} else {
die("{'code':'1','msg':'保存失败'}");
}
}
}
示例12: del
public function del()
{
check_login();
check_level(3);
$del_id = I("get.del_id", '', 'number_int');
$shop_id = I("get.shop_id", '', 'number_int');
if ($del_id && $shop_id) {
//echo $del_id.$shop_id;
D('dish')->where('dish_id=' . $del_id)->delete();
$this->success('删除成功', 'index.php?s=Admin/menu/shop_edit/edit_id/' . $shop_id);
} else {
$this->error('非法操作!');
}
}
示例13: del
public function del()
{
/*不要乱删店,评论等也会全没了*/
check_login();
check_level(3);
$del_id = I("get.del_id", '', 'number_int');
if ($del_id) {
//echo $del_id;
D('shop')->where('shop_id=' . $del_id)->delete();
D('dcomment')->where('shop_id=' . $del_id)->delete();
D('dish')->where('shop_id=' . $del_id)->delete();
$this->success('删除成功', 'index.php?s=Admin/node/index');
} else {
$this->error('非法操作!');
}
}
示例14: m__order
function m__order()
{
global $t_obj, $l_obj;
//判断操作权限
check_level("H0703");
$ids = json_decode(stripslashes(urldecode($_POST['params'])), true);
foreach ($ids as $a) {
$params['qorder'] = $a['val'];
$res = $t_obj->update($params, $a['id']);
}
if ($res['state'] == 0) {
$l_obj->insert("修改排序成功");
die('{"code":"0","msg":"排序修改成功"}');
}
die('{"code":"100","msg":"排序修改失败"}');
}
示例15: m__del_attr
function m__del_attr()
{
global $m_obj, $l_obj;
check_level("D0304");
$post = $_POST;
$model_id = isset($_GET['mid']) ? $_GET['mid'] : 0;
$where = " model_id = " . $model_id . " and field = '" . $post['field'] . "'";
$res = $m_obj->delete_model_field($where);
if ($res) {
$l_obj->insert("删除字段成功");
die('{"code":0,"msg":"删除成功"}');
} else {
die('{"code":1,"msg":"删除失败 "}');
}
}