本文整理汇总了PHP中check_admin函数的典型用法代码示例。如果您正苦于以下问题:PHP check_admin函数的具体用法?PHP check_admin怎么用?PHP check_admin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_admin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_logs
function check_logs($login, $passwd)
{
$swag = file_get_contents("private/passwd");
$unserialized = unserialize($swag);
$hashed_pwd = hash("whirlpool", $passwd);
$i = 0;
while ($unserialized[$i]) {
if ($unserialized[$i]['login'] === $login) {
if ($unserialized[$i]['passwd'] === $hashed_pwd) {
if (check_admin($login) === TRUE) {
$_SESSION['admin'] = 'ok';
} else {
$_SESSION['admin'] = "";
}
return TRUE;
} else {
$_SESSION['message'] = "Veuillez saisir une combinaison login/mot de passe valide.";
return FALSE;
}
}
$i = $i + 1;
}
$_SESSION['message'] = "Erreur très très louche.";
return FALSE;
}
示例2: check_auth
/**
* 检查是否具有权限(模板使用)
* @param $authStr
* @return \Illuminate\Http\RedirectResponse
*/
function check_auth($authStr)
{
if (check_admin()) {
return true;
}
if (in_array($authStr, session('loginUser')->auth['authList'])) {
return true;
}
return false;
}
示例3: step
function step($is_submit)
{
$is_external_users = $_SESSION['install']['db']['users_exists'];
if ($is_submit) {
if ($is_external_users) {
return array('error' => false);
}
return check_admin();
}
$result = array('html' => render('step_admin', array('is_external_users' => $is_external_users, 'users_table' => $_SESSION['install']['db']['users_table'])));
return $result;
}
示例4: action_add
public function action_add()
{
$community = $this->request->param('id');
if (!$community) {
$this->request->redirect(URL::base() . 'tournament');
}
$view = View::factory('tournament_add');
$view->community = com_from_id($community);
$view->available_maps = get_maps();
/*
$view->refs = '';
$view->maps = '';
*/
$view->description = '';
$view->exclusive = '';
if ($_POST) {
$refs = array();
$refCount = $_POST['refCount'];
for ($i = 1; $i <= $refCount; $i++) {
array_push($refs, $_POST['ref' . $i]);
}
$ref_ids = array();
foreach ($refs as $ref) {
if (!id_from_name($ref)) {
array_push($this->template->errors, "Could not find user: " . $ref);
} else {
array_push($ref_ids, id_from_name($ref));
}
}
//die(Debug::vars($ref_ids));
$maps = array();
$mapCount = $_POST['mapCount'];
for ($i = 1; $i <= $mapCount; $i++) {
array_push($maps, $_POST['map' . $i]);
}
$description = @htmlspecialchars($_POST['description']);
$exclusive = @htmlspecialchars($_POST['exclusive']);
if (!check_admin($this->user, $community)) {
array_push($this->template->errors, "You are not the admin of this community.");
}
if (empty($this->template->errors)) {
//DB::insert('tournies', array('community','admin','description','exclusive'))->values(array($community,$this->user,$description,$exclusive))->execute();
$this->request->redirect("/tournament?success");
} else {
$view->description = $description;
$view->exclusive = $exclusive;
}
}
$this->template->content = $view;
}
示例5: inform_and_exit_if_not_admin
function inform_and_exit_if_not_admin()
{
switch (check_admin()) {
case 98:
echo json_encode(array('iserror' => true, "result" => "KO", 'errno' => 98, 'errorMsg' => 'not administrator'));
exit(1);
break;
case 99:
echo json_encode(array('iserror' => true, "result" => "KO", "errno" => 99, "errMsg" => "not connected"));
exit(1);
case 0:
break;
default:
echo json_encode(array('iserror' => true, "result" => "KO", "errno" => 1, "errMsg" => "unknown error"));
exit(1);
}
}
示例6: app_settings
function app_settings($folder = NULL)
{
check_admin();
$set = NULL;
$data['app'] = $this->admin->get_app_info_by_folder($folder);
$data['config'] = NULL;
$path = ROOT . 'application/app/' . $folder . '/controller/';
if (file_exists($path . 'admin_config.php')) {
include_once $path . 'admin_config.php';
$data['config'] = $config;
foreach ($config as $k => $v) {
if (!is_array($v)) {
$set .= "set( '{$k}' , '{$v}' );";
}
}
}
$data['set'] = $set;
$data['folder'] = $folder;
$this->view('app_settings', $data);
}
示例7: check_admin
<?php
if (isset($_POST['submit'])) {
$email = $_POST['Email'];
$pass = $_POST['Password'];
$check = check_admin($email, $pass);
if ($check) {
$_SESSION['email'] = $email;
$_SESSION['password'] = $pass;
header('location:index.php?lang=' . $lang . '&controller=dashboard');
} else {
$error = 'Sign in Failure ! Please try again.';
}
}
?>
<?php
require 'view/sign/index.php';
示例8: get_number_recored
<?php
$visa = get_number_recored('passport_visa_offers');
$tour = get_number_recored('tour_content');
$contact = get_number_recored('contact');
$news = get_number_recored('news_event_content');
$labor = get_number_recored('labor_content');
$car_service = get_number_recored('car_service');
$ticket_plane = get_number_recored('ticket_plane_content');
$abroad = get_number_recored('abroad_offers');
$lang = get_lang();
if (isset($_SESSION['email']) && isset($_SESSION['password'])) {
$email = $_SESSION['email'];
$password = $_SESSION['password'];
$check = check_admin($email, $password);
if ($check) {
$active = 'Dashboard';
require 'template/header.php';
require_once 'view/dashboard/index.php';
} else {
header('location: index.php?lang=' . $lang . '&controller=sign');
}
} else {
header('location: index.php?lang=' . $lang . '&controller=sign');
}
示例9: header
header("Location:?act=login&err=" . urlencode('用户名不能为空'));
exit;
} elseif ($admin_pwd == '') {
header("Location:?act=login&err=" . urlencode('密码不能为空'));
exit;
}
$captcha = get_cache('captcha');
if (empty($postcaptcha) && $captcha['verify_adminlogin'] == '1') {
header("Location:?act=login&err=" . urlencode('验证码不能为空'));
exit;
}
if ($captcha['verify_adminlogin'] == '1' && strcasecmp($_SESSION['imageCaptcha_content'], $postcaptcha) != 0) {
write_log("<span style=\"color:#FF0000\">验证码填写错误</span>", $admin_name, 2);
header("Location:?act=login&err=" . urlencode('验证码填写错误'));
exit;
} elseif (check_admin($admin_name, $admin_pwd)) {
$admininfo = get_admin_one($admin_name);
if (!in_array($_CFG['subsite_id'], explode(',', $admininfo['site_purview'])) && $admininfo['purview'] != "all") {
write_log("<span style=\"color:#FF0000\">您没有管理权限</span>", $admin_name, 2);
header("Location:?act=login&err=" . urlencode('没有管理权限'));
exit;
}
update_admin_info($admin_name);
write_log("成功登录", $admin_name);
if ($remember == 1) {
$admininfo = get_admin_one($admin_name);
setcookie('Qishi[admin_id]', $_SESSION['admin_id'], time() + 86400, $QS_cookiepath, $QS_cookiedomain);
setcookie('Qishi[admin_name]', $admin_name, time() + 86400, $QS_cookiepath, $QS_cookiedomain);
setcookie('Qishi[admin_pwd]', md5($admin_name . $admininfo['pwd'] . $admininfo['pwd_hash'] . $QS_pwdhash), time() + 86400, $QS_cookiepath, $QS_cookiedomain);
}
} else {
示例10: session_start
include_once '../lib/php/auth_utils.php';
session_start();
if (isset($DEBUG_ON) && $DEBUG_ON == 1) {
ob_start();
print_r($_REQUEST);
$debug_msg = ob_get_contents();
ob_end_clean();
error_log($debug_msg);
}
$server = "127.0.0.1";
$port = "3306";
$base = "domotique";
$user = "domotique";
$password = "maison";
header('Content-Type: text/javascript');
$check = check_admin();
switch ($check) {
case 98:
break;
case 99:
echo "console.log('pas habilité');\n";
echo $callback . "([]);";
exit(1);
case 0:
break;
default:
echo "console.log('erreur inconnue');\n";
echo $callback . "([]);";
exit(1);
}
if (!isset($_REQUEST['sensor_id'])) {
示例11: check_admin
<?php
include_once '../../lib/common.function.php';
check_admin();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Examples</title>
<link href="../css/style.css" rel="stylesheet">
<link href="../css/font-awesome.min.css" rel="stylesheet">
<link href="../css/bootstrap.min.css" media="all" rel="stylesheet">
<link rel="stylesheet" href="../css/bootstrapValidator.css"/>
<script type="text/javascript" src="../js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/bootstrapValidator.js"></script>
<script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
</head>
<body>
<div class="col-xs-8">
<form method="post" class="form-horizontal center-block" action="../do.php?f=index_content_add_vector">
<table class="table table-bordered">
<caption><h2>矢量图内容添加</h2></caption>
<tbody>
<tr>
<td>标题</td>
<td><textarea class="form-control" name="index-title" placeholder="title"></textarea></td>
</tr>
<tr>
<td>内容</td>
示例12: session_start
<?php
include_once '../lib/configs.php';
include_once '../lib/php/auth_utils.php';
session_start();
if (isset($DEBUG_ON) && $DEBUG_ON == 1) {
ob_start();
print_r($_REQUEST);
$debug_msg = ob_get_contents();
ob_end_clean();
error_log($debug_msg);
}
switch (check_admin()) {
case 98:
error_log("not administrator");
echo json_encode(array('iserror' => true, 'errno' => 98, 'errorMsg' => 'not administrator'));
exit(1);
break;
case 99:
error_log("not connected");
echo json_encode(array('iserror' => true, 'errno' => 99, 'errorMsg' => 'not connected'));
exit(1);
case 0:
break;
default:
error_log("unknown error");
echo json_encode(array('iserror' => true, 'errno' => 100, 'errorMsg' => 'unknown'));
exit(1);
}
if (!isset($_REQUEST['id'])) {
echo json_encode(array('iserror' => true, 'errno' => 1, 'errorMsg' => 'id is mandatory'));
示例13: del
function del($id = NULL)
{
check_admin();
$pro = $this->pro->load_item($id);
if (!$pro) {
info_page(_text('system_error_id'));
die;
}
$this->pro->del($id);
if ($pro['u2_pic']) {
@unlink($pro['u2_pic']);
}
info_page(_text('pro_del_success'), '/riki/plist/' . $pro['u2_cate']);
}
示例14:
?>
</div></a></li>
<li><a discount="profile" class="profm"><img src="images/profil/menu/profile.png" width="20" height="20" /> Profile</a></li>
<li><a><img src="images/profil/menu/settings.png" width="20" height="20" /> Profile</a>
<ul>
<li><a discount="settings/hotel_detail" class="profm"><img src="images/profil/menu/hotel_detail.png" width="20" height="20" /> Hotel details</a></li>
<li><a discount="settings/design" class="profm"><img src="images/profil/menu/template.png" width="20" height="20" /> Profile Template</a>
<ul>
<li><a discount="settings/dcolors" class="profm"><img src="images/profil/menu/colors.png" width="20" height="20" /> Colors</a></li>
<li><a discount="settings/dimages" class="profm"><img src="images/profil/menu/images.png" width="20" height="20" /> Images</a></li>
<li><a discount="settings/dadvanced" class="profm"><img src="images/profil/menu/advanced.png" width="20" height="20" /> Advanced</a></li>
</ul>
</li>
<li><a discount="settings/privacy" class="profm"><img src="images/profil/menu/privacy.png" width="20" height="20" /> Privacy Settings</a></li>
<?php
if (check_admin(2)) {
?>
<li><a discount="settings/logs" class="profm"><img src="images/profil/menu/logs.png" width="20" height="20" /> Logs</a></li><?php
}
?>
</ul>
</li>
<li><a discount="add_post" class="profm"><img src="images/profil/menu/post.png" width="20" height="20" /> Write Post</a></li>
<li><a discount="manage_rooms" class="profm"><img src="images/profil/menu/rooms.png" width="20" height="20" /> Manage rooms</a>
<!--<ul>
<li><a href="#managerooms/Room1">Room 1</a></li>
<li><a href="#managerooms/Room2">Room 2</a>
<ul>
<li><a href="#managerooms/Room2/Room2.1">Room 2.1</a></li>
<li><a href="#managerooms/Room2/Room2.2">Room 2.2</a></li>
<li><a href="#managerooms/Room2/Room2.3">Room 2.3</a></li>
示例15: die
}
$tr = "";
if ($id) {
$tr = "contact{$id}";
}
return "<tr id=\"{$tr}\"><td>{$removes}{$lhs}:{$removee}</td> <td>{$rhs}</td></tr>";
}
$dbconn = dbauth::connect('directory', null, $_SERVER['REMOTE_USER']) or die("Could not connect: " . pg_last_error());
pg_query($dbconn, "begin");
$personid = isset($_GET['person_id']) ? $_GET['person_id'] : null;
// the order by is used to get the non-NULL ones pushed to the top , tho now
// there should be only one row
$query = "\n\tSELECT p.person_id,\n\t\tcoalesce(p.preferred_first_name, p.first_name) as first_name,\n\t\tcoalesce(p.preferred_last_name, p.last_name) as last_name,\n\t\tcoalesce(pc.nickname, p.nickname) as nickname,\n\t\tpc.position_title,\n\t\tpc.person_company_relation,\n\t\tdate_part('month', p.birth_date) as birth_date_month,\n\t\tdate_part('day', p.birth_date) as birth_date_day,\n\t\tdate_part('epoch', p.birth_date) as birth_date_epoch,\n\t\tpc.hire_date,\n\t\tc.company_name,\n\t\tc.company_id,\n\t\tpi.person_image_id,\n\t\tpc.manager_person_id,\n\t\tcoalesce(mgrp.preferred_first_name, mgrp.first_name) as mgr_first_name,\n\t\tcoalesce(mgrp.preferred_last_name, mgrp.last_name) as mgr_last_name,\n\t\tac.account_collection_id,\n\t\tac.account_collection_name,\n\t\ta.login,\n\t\tnumreports.tally as num_reports,\n\t\tofc.display_label,\n\t\tofc.physical_address_id,\n\t\tofc.building,\n\t\tofc.floor,\n\t\tofc.section,\n\t\tofc.seat_number\n\tFROM v_corp_family_account a\n\t\tINNER JOIN person p using (person_id)\n\t\tINNER JOIN company c using (company_id)\n\t\tINNER JOIN person_company pc using (person_id,company_id)\n\t\tLEFT JOIN ( select ac.*, account_id\n\t\t\t FROM account_collection ac\n\t\t\t\tINNER JOIN account_collection_account\n\t\t\t\tUSING (account_collection_id)\n\t\t\t WHERE account_collection_type = 'department'\n\t\t) ac USING (account_id)\n\t\tLEFT JOIN (\n\t\t select pi.*, piu.person_image_usage\n\t\t from person_image pi\n\t\t\t inner join person_image_usage piu\n\t\t\t\ton pi.person_image_id = piu.person_image_id\n\t\t\t\tand piu.person_image_usage = 'corpdirectory'\n\t\t ) pi USING (person_id)\n\t\tLEFT JOIN (\n\t\t select manager_person_id as person_id, count(*) as tally\n\t\t\t from person_company\n\t\t\t where person_company_status = 'enabled'\n\t\t\t group by manager_person_id\n\t\t) numreports USING (person_id)\n\t\tLEFT JOIN (\n\t\t select pl.person_id,\n\t\t\tpa.physical_address_id,\n\t\t\tpa.display_label,\n\t\t\tpl.building,\n\t\t\tpl.floor,\n\t\t\tpl.section,\n\t\t\tpl.seat_number\n\t\t from person_location pl\n\t\t\tinner join physical_address pa\n\t\t\t USING (physical_address_id)\n\t\t where pl.person_location_type = 'office'\n\t\t order by site_rank\n\t\t) ofc USING (person_id)\n\t\tLEFT JOIN person mgrp\n\t\t on pc.manager_person_id = mgrp.person_id\n\tWHERE p.person_id = \$1 \n\tAND (pc.hire_date is null or pc.hire_date <= now())\n\tAND a.account_role = 'primary'\n\tORDER BY ac.account_collection_name\n;\n";
$result = pg_query_params($dbconn, $query, array($personid)) or die('Query failed: ' . pg_last_error());
$row = pg_fetch_array($result, null, PGSQL_ASSOC) or die("no person");
if ($row['login'] == $_SERVER['REMOTE_USER'] || check_admin($dbconn, $_SERVER['REMOTE_USER'])) {
$canedit = 1;
} else {
$canedit = 0;
}
$name = $row['first_name'] . " " . $row['last_name'];
$title = $row['position_title'];
$teamc = " (" . $row['company_name'] . ")";
if (isset($row['mgr_last_name'])) {
$manager = $row['mgr_first_name'] . " " . $row['mgr_last_name'];
}
echo build_header($name);
echo browsingMenu($dbconn, null);
if (isset($_GET['random']) && $_GET['random'] == 'yes') {
echo "<div id=random> <a href=\"./?index=random\"> Another Random Person </a> </div>\n";
}