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


PHP ensure_role函数代码示例

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


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

示例1: ensure_role

<?php

include '../../config.php';
//ensure_permission('acc');
ensure_role('admin,sadmin,mod,viewer');
if (isset($_REQUEST['submit'])) {
    $id = $_REQUEST['id'];
    $username = $_REQUEST['username'];
    $password1 = $_REQUEST['password1'];
    $password2 = $_REQUEST['password2'];
    $phone = $_REQUEST['phone'];
    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";
        }
    }
    if ($err != "") {
        echo "<span class='label label-important'><i class='icon-info-sign'></i> {$err}</span>";
    } else {
        if ($password1 == '' && $password2 == '') {
            $password = $db->getone("select password from users where id={$id}");
        } else {
            $password = md5($password1);
        }
        $sql = "update users set `password` = '{$password}',`phone`='{$phone}' where id={$id}";
开发者ID:LAOSChool,项目名称:Web,代码行数:31,代码来源:acc_m_account_edit.php

示例2: 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

示例3: 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

示例4: ensure_permission

<?php

include "../../config.php";
ensure_permission('sadmin');
ensure_role('sadmin');
$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 number</b> can't blank";
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}'");
if ($rown > 0 || $username == 'itpro') {
    $err = "<b>Username</b> already exist";
}
if (strlen($username) < 2) {
    $err = "<b>Username</b> must include at least 3 characters";
}
开发者ID:LAOSChool,项目名称:Web,代码行数:31,代码来源:sadmin_user_add.php


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