• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getRole函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: set

 public function set()
 {
     daocall('setting', 'add', array('view_dir', $_REQUEST['view_dir']));
     daocall('setting', 'add', array('reg_user_price', $_REQUEST['reg_user_price'] * 100));
     daocall('setting', 'add', array('reg_off', $_REQUEST['reg_off']));
     daocall('setting', 'add', array('findpasswd_off', $_REQUEST['findpasswd_off']));
     daocall('setting', 'add', array('try_day', $_REQUEST['try_day']));
     if ($_REQUEST['view_dir'] != $this->setting['view_dir']) {
         $log = array('operate_object' => 'view_dir=' . $_REQUEST['view_dir'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['c'] . "&a=" . $_REQUEST['a']);
         apicall('operatelog', 'operatelogAdd', array($log));
     }
     if ($_REQUEST['reg_user_price'] * 100 != $this->setting['reg_user_price']) {
         $log = array('operate_object' => 'reg_user_price=' . $_REQUEST['reg_user_price'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['c'] . "&a=" . $_REQUEST['a']);
         apicall('operatelog', 'operatelogAdd', array($log));
     }
     if ($_REQUEST['reg_off'] != $this->setting['reg_off']) {
         $log = array('operate_object' => 'reg_off=' . $_REQUEST['reg_off'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['c'] . "&a=" . $_REQUEST['a']);
         apicall('operatelog', 'operatelogAdd', array($log));
     }
     if ($_REQUEST['findpasswd_off'] != $this->setting['findpasswd_off']) {
         $log = array('operate_object' => 'findpasswd_off=' . $_REQUEST['findpasswd_off'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['c'] . "&a=" . $_REQUEST['a']);
         apicall('operatelog', 'operatelogAdd', array($log));
     }
     return header('Location: ?c=function&a=setFrom');
 }
开发者ID:srdc2014,项目名称:vhms,代码行数:25,代码来源:function.ctl.php


示例2: index

 public function index()
 {
     if (isset($_SESSION[C('USER_AUTH_KEY')])) {
         //显示菜单项
         $menu = array();
         $model = M("AdminMenu");
         if (session("administrator")) {
             //echo 'dd';
         } else {
             //echo 'bb';
             $uid = getMemberId();
             $role = getRole($uid);
             //继续。。
             //获取用户
         }
         $list = $model->where('display=1')->order(array('fid' => 'asc', 'sort' => 'asc'))->select();
         $menu = fetchMenu($list, 0);
         $menu_html = displayMenu($menu, false);
         $this->assign('menu', $menu_html);
     }
     C('SHOW_RUN_TIME', false);
     // 运行时间显示
     C('SHOW_PAGE_TRACE', false);
     $this->display();
 }
开发者ID:yunsite,项目名称:nuomituan,代码行数:25,代码来源:IndexAction.class.php


示例3: login

function login($ip, $nick, $password)
{
    /*$intentos = 0;
    		if (isset($_COOKIE['intentos'])){ 
    			$intentos = $_COOKIE['intentos'];
    		}
    				
    		if ($intentos <= 3){*/
    $hashedPassword = hash("sha256", $password, false);
    if (checkNickPassword($nick, $hashedPassword)) {
        $email = getEmail($nick);
        $_SESSION['nick'] = $nick;
        $_SESSION['email'] = $email;
        $_SESSION['role'] = getRole($email);
        //setcookie( 'intentos', 0, time() + 1800 ); //30 minutos
        addAction($nick, $email, $ip, 'logged_in');
        addConnection($nick, $email, $ip);
        return '0';
        // Logged.
    } else {
        //if ($intentos < 3) {
        //setcookie( 'intentos', $intentos + 1, time() + 1800 ); //30 minutos
        return '1';
        // Log in failed.
    }
    /*} 
    		
    		setcookie( 'intentos', 0, time() + 1800);
    		return '2';	// Superado el límite de intentos.
    		*/
}
开发者ID:jagumiel,项目名称:bigou-Album,代码行数:31,代码来源:user_logic.php


示例4: getListByQuery

 function getListByQuery($query, $department, $rtype = '')
 {
     $sDeptCondition = '';
     $sCondition = '';
     $sYear = getSchoolYear($this);
     if (getRole($this) == 2) {
         $sDept = $this->mod->getDeptOfEmployee(getUserId($this));
         $sDept = $sDept[0]->department_id;
         $sDeptCondition = "employees.department_id = {$sDept} and";
     }
     $sDeptCondition = '';
     $rCondition = '';
     if (getRole($this) != 2 && ($department != -1 && !empty($department))) {
         $sDeptCondition = "(employees.department_id = {$department}) and";
     }
     if (!empty($query)) {
         $sCondition = "(employees.empno like '%{$query}%' or employees.fname like '%{$query}%' or employees.lname like '%{$query}%') and";
     }
     $iProfileId = getUserId($this);
     if (getRole($this) == 2) {
         $sdep = $this->mod->getDeptOfEmployee($iProfileId);
         $sDeptCondition = "(employees.department_id = {$sdep[0]->department_id}) and ";
     }
     if (!empty($rtype)) {
         if (strpos($rtype, 'nal') !== false) {
             $rCondition = "and if(emp_types.time_unit = 'd', \r\n\r\n                    (select (sum(abs(datediff(g.end_date, g.start_date)) - abs(g.end_date_hw + g.start_date_hw)) +1)\r\n                        from \r\n                            leave_transactions g, leave_credits \r\n                        where \r\n\r\n                            employment_id = employment.id and \r\n                            leave_credits.id = leave_credits_id and \r\n                                                        leave_credits.is_base = 1 and g.schoolyear = '{$sYear}'),\r\n\r\n\r\n\r\n\r\n                    round((        select (sum(timediff(g.end_time,g.start_time)))/10000 from \r\n                            leave_transactions g \r\n                        where \r\n\r\n                            g.employment_id = employment.id and g.schoolyear = '{$sYear}'\r\n\r\n                    ),2)) is null";
         }
     }
     $query = $this->db->query("\r\n            select \r\n                employees.id as myid, \r\n                employment.*, \r\n                employees.*,\r\n                ranks.*,\r\n                roles.*,\r\n                departments.*,\r\n                emp_types.*,\r\n                status.*,\r\n                emp_types.time_unit as timeunit\r\n            from \r\n                employment, \r\n                emp_types, \r\n                status, \r\n                employees, \r\n                emp_types_stat,\r\n                ranks,\r\n                departments,\r\n                roles\r\n            where \r\n                ({$sCondition} {$sDeptCondition} \r\n                employment.emp_types_stat_id = emp_types_stat.id and\r\n                \r\n                emp_types.id = emp_types_stat.emp_types_id and \r\n                \r\n                status.id = emp_types_stat.status_id and \r\n                \r\n                employment.employee_id = employees.id and\r\n                \r\n                employees.rank_id = ranks.id and\r\n                \r\n                employees.department_id = departments.id and\r\n                \r\n                employees.role_id = roles.id) {$rCondition} \r\n\r\n                group by employees.department_id, lname, fname\r\n                ");
     if ($query->num_rows() > 0) {
         return $query->result();
     } else {
         return "";
     }
 }
开发者ID:acelumaad,项目名称:leave-system,代码行数:35,代码来源:employment_model.php


示例5: getQueryList

 function getQueryList($sEmployeeId = '', $sDept = '', $sStat = '', $rType = '')
 {
     $sCondition = '';
     $sDeptCondition = '';
     $sStatCondition = '';
     $sRtype = '';
     if (!empty($sEmployeeId)) {
         $sCondition = "and e.id = {$sEmployeeId}";
     }
     if (!empty($sStat) && strpos($sStat, "All") === false) {
         $sStatCondition = "and g.status = '{$sStat}'";
     }
     if (!empty($sDept) && $sDept != -1) {
         $sDeptCondition = "and e.department_id = {$sDept}";
     }
     if (!empty($rType)) {
         $sRtype = '';
     }
     $iProfileId = getUserId($this);
     if (getRole($this) == 2) {
         $sdep = $this->mod->getDeptOfEmployee($iProfileId);
         $sDeptCondition = "and (e.department_id = {$sdep[0]->department_id})";
     } else {
         if (getRole($this) == 3) {
             $sDeptCondition = "and (e.id = {$iProfileId})";
         }
     }
     $query = $this->db->query("\r\n                select \r\n                    g.*,\r\n                    concat(e.fname,' ',e.lname) as employee,\r\n                    datediff(g.end_date, g.start_date) as leaves                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              \r\n                from \r\n                    leave_transactions g, \r\n                    employees e,\r\n                    employment em \r\n                where (g.employment_id = em.id and em.employee_id = e.id) \r\n                    {$sCondition} \r\n                    {$sStatCondition} \r\n                    {$sDeptCondition}\r\n                order by g.filing_date desc");
     $aResult = $query->result();
     return $query->result();
 }
开发者ID:acelumaad,项目名称:leave-system,代码行数:31,代码来源:leave_transactions_model.php


示例6: adminOnly

function adminOnly($role)
{
    // Redirect all if not admin.
    if (getRole() < 3) {
        header('Location: /');
        exit;
    }
}
开发者ID:Braatan,项目名称:Engrave,代码行数:8,代码来源:functions.php


示例7: del

 public function del()
 {
     $ret = daocall('admin_user', 'delUser', array($_REQUEST['username']));
     if ($ret) {
         $log = array('admin' => getRole('admin'), 'operate' => $_REQUEST['a'], 'operate_object' => 'username=' . $_REQUEST['username']);
         apicall('operatelog', 'operatelogAdd', array($log));
     }
     header("Location: ?c=adminuser&a=listUser");
 }
开发者ID:srdc2014,项目名称:vhms,代码行数:9,代码来源:adminuser.ctl.php


示例8: verificaRespostaCriterio

 public function verificaRespostaCriterio($enterpriseId, $perguntaId, $competitionId)
 {
     $configDb = Zend_Registry::get('configDb');
     $query = $this->select()->setIntegrityCheck(false)->from(array('CHEKEV' => 'CheckerEvaluation'))->join(array('CHEKente' => 'CheckerEnterprise'), 'CHEKEV.CheckerEnterpriseId = CHEKente.ID', NULL)->where('CHEKente.EnterpriseId = ?', $enterpriseId)->where('CHEKEV.QuestionCheckerId = ?', $perguntaId);
     $query->reset(Zend_Db_Select::COLUMNS)->columns(array('CHEKEV.QuestionCheckerId', 'CHEKEV.Resposta'));
     $objResult = getRole($this->fetchRow($query));
     $resposta = array();
     $resposta[$objResult['QuestionCheckerId']] = $objResult['Resposta'];
     return $resposta;
 }
开发者ID:Lazaro-Gallo,项目名称:psmn,代码行数:10,代码来源:ApeEvaluationVerificador.php


示例9: manPayReturn

 /**
  * 用户充值成功,但没有到账,管理员手动给用户确认到账
  * Enter description here ...
  */
 public function manPayReturn()
 {
     if (apicall('money', 'payReturn', array($_REQUEST['id']))) {
         $this->_tpl->assign('msg', '充值成功');
         $log = array('operate_object' => 'id=' . $_REQUEST['id'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['a']);
         apicall('operatelog', 'operatelogAdd', array($log));
     } else {
         $this->_tpl->assign('msg', '充值失败');
     }
     return $this->display('msg.html');
 }
开发者ID:srdc2014,项目名称:vhms,代码行数:15,代码来源:money.ctl.php


示例10: delMproductorder

 public function delMproductorder()
 {
     $result = daocall('mproductorder', 'del', array(intval($_REQUEST['id'])));
     if (!$result) {
         $this->_tpl->assign('msg', '删除失败');
         return $this->_tpl->fetch('msg.html');
     }
     $log = array('operate_object' => 'id=' . $_REQUEST['id'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['a']);
     apicall('operatelog', 'operatelogAdd', array($log));
     return $this->pageListMproductorder();
 }
开发者ID:srdc2014,项目名称:vhms,代码行数:11,代码来源:mproductorder.ctl.php


示例11: delAgent

 public function delAgent()
 {
     if (!daocall('agent', 'del', array($_REQUEST['id']))) {
         $this->_tpl->assign('msg', "删除失败");
         return $this->_tpl->fetch('msg.html');
     }
     $log = array('operate_object' => 'id=' . $_REQUEST['id'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['a']);
     apicall('operatelog', 'operatelogAdd', array($log));
     daocall('user', 'updateUserAgent_idByAent_id', array($_REQUEST['id']));
     daocall('agentprice', 'delAgentpriceByAgent_id', array($_REQUEST['id']));
     return $this->listAgent();
 }
开发者ID:srdc2014,项目名称:vhms,代码行数:12,代码来源:agent.ctl.php


示例12: login

 public function login()
 {
     $user = $this->checkPassword($_REQUEST['username'], $_REQUEST['passwd']);
     if (!$user) {
         return $this->_tpl->display('login_error.html');
         //die('登录错误![<a href="javascript:history.go(-1);">返回</a>]');
     }
     registerRole('admin', $user['username']);
     $_SESSION['admin_last_login'] = $user['last_login'];
     $_SESSION['admin_last_ip'] = $user['last_ip'];
     $log = array('operate_object' => 'username=' . $_REQUEST['username'], 'mem' => 'ip=' . $_SERVER["REMOTE_ADDR"], 'admin' => getRole('admin'), 'operate' => $_REQUEST['c'] . "&a=" . $_REQUEST['a']);
     apicall('operatelog', 'operatelogAdd', array($log));
     header("Location: index.php");
 }
开发者ID:srdc2014,项目名称:vhms,代码行数:14,代码来源:session.ctl.php


示例13: showMyProposalPage

function showMyProposalPage()
{
    //TODO check for the role of current user
    $role = getRole();
    if (!Users::isStudent()) {
        echo t('You can only see this page as a student');
        return;
    }
    //Get my groups
    $my_proposals = Proposal::getInstance()->getMyProposals();
    //::getGroups(_ORGANISATION_GROUP);
    if (!$my_proposals) {
        echo t('You have no proposal at the moment.') . '<br/>';
        echo "<a href='" . _WEB_URL . "/projects/browse'>" . t('Please find yourself a project') . "</a>.";
    } else {
        $current_tab = getRequestVar('new_tab', 0);
        showMyProposals($my_proposals, $current_tab);
    }
}
开发者ID:edwinraycom,项目名称:vals-soc,代码行数:19,代码来源:proposals.php


示例14: getSysadmin

 public function getSysadmin()
 {
     $c = new Criteria();
     $users = UserPeer::doSelect($c);
     foreach ($users as $user1) {
         $userrole = $user1->getUserRoles();
         $found = false;
         foreach ($userroles as $userrole) {
             if ($userrole . getRole()->getName() == 'sysadmin') {
                 $found = true;
                 break;
             }
         }
         if (found == true) {
             return $user1;
         }
     }
     return null;
 }
开发者ID:Ayaan123,项目名称:alumnisangam,代码行数:19,代码来源:UserPeer.php


示例15: moneyout

 public function moneyout()
 {
     $page = intval($_REQUEST['page']);
     if ($page <= 0) {
         $page = 1;
     }
     $page_count = 15;
     $count = 0;
     $list = daocall('moneyout', 'pageByUser', array(getRole('user'), $page, $page_count, &$count));
     $total_page = ceil($count / $page_count);
     if ($page >= $total_page) {
         $page = $total_page;
     }
     $this->_tpl->assign('count', $count);
     $this->_tpl->assign('total_page', $total_page);
     $this->_tpl->assign('page', $page);
     $this->_tpl->assign('page_count', $page_count);
     $this->_tpl->assign('list', $list);
     return $this->_tpl->fetch('money/moneyout.html');
 }
开发者ID:srdc2014,项目名称:vhms,代码行数:20,代码来源:money.ctl.php


示例16: pageByuser

 public function pageByuser()
 {
     $sortname = $_REQUEST['sortname'];
     $page = intval($_REQUEST['page']);
     if ($page <= 0) {
         $page = 1;
     }
     $page_count = 30;
     $count = 0;
     $list = daocall('question', 'pageByuser', array(getRole('user'), $page, $page_count, &$count, $sortname));
     $total_page = ceil($count / $page_count);
     if ($page >= $total_page) {
         $page = $total_page;
     }
     $this->_tpl->assign('sortname', $sortname);
     $this->_tpl->assign('count', $count);
     $this->_tpl->assign('total_page', $total_page);
     $this->_tpl->assign('page', $page);
     $this->_tpl->assign('page_count', $page_count);
     $this->_tpl->assign('list', $list);
     return $this->_tpl->fetch('question/pagelist.html');
 }
开发者ID:srdc2014,项目名称:vhms,代码行数:22,代码来源:question.ctl.php


示例17: chronology

function chronology($type, $product_id)
{
    if ($type == 0) {
        $query = "SELECT pp_ref_no,pp_nama_brand,pp_nama_generic,pp_nama,\n              DATE_FORMAT(pp_pkk_screen_tkh,'%d/%m/%Y %h:%i:%s %p') AS pp_pkk_screen_tkh FROM p_product\n              WHERE pp_kod='{$product_id}'";
        $result = selQuery($query);
        $row = mysqli_fetch_assoc($result);
        $query = "SELECT la_ru_kod,DATE_FORMAT(lab_assign_date,'%d/%m/%Y %h:%i:%s %p') AS lab_assign_date FROM lab_assign\n              WHERE la_pp_kod='{$product_id}'";
        $result = selQuery($query);
        $assign = mysqli_fetch_assoc($result);
        ?>
<div class="admin-form" id="previewChrono">
  <div class="row">
    <div class="alert alert-sm alert-border-left alert-primary"><b>Product Information</b></div>
    <div class="col-md-6">
    <b>Reference No : </b>
    <p><?php 
        echo isEmpty($row['pp_ref_no']);
        ?>
</p>
    </div>
    <div class="col-md-6">
    <b>Brand Name : </b>
    <p><?php 
        echo isEmpty($row["pp_nama_brand"]);
        ?>
</p>
    </div>
    <div class="col-md-6">
    <b>Generic Name : </b>
    <p><?php 
        echo isEmpty($row["pp_nama_generic"]);
        ?>
</p>
    </div>
    <div class="col-md-6">
    <b>Full product name : </b>
    <p><?php 
        echo isEmpty($row["pp_nama"]);
        ?>
</p>
    </div>
  </div>
  <div class="row">
    <div class="section-divider mb40"></div>
  </div>
  <div class="row">
    <ol class="timeline-list">
      <!-- <li class="timeline-item">
        <div class="timeline-icon bg-warning">
          <span class="fa fa-calendar"></span>
        </div>
        <div class="timeline-desc">
          <p>Screening Date</p>
        </div>
        <div class="timeline-date"><?php 
        //echo $row['pp_pkk_screen_tkh'];
        ?>
</div>
      </li>
      <li class="timeline-item">
        <div class="timeline-icon bg-warning">
          <span class="fa fa-calendar"></span>
        </div>
        <div class="timeline-desc">
          <p>Product Distribution</p>
          <?php 
        // $labs = "";
        // while($lab = mysqli_fetch_assoc($result)) {
        //   $labs = $labs."<small>".retriveLab($lab['la_ru_kod'])."</small><br />";
        // }
        // echo $labs;
        ?>
        </div>
        <div class="timeline-date"><?php 
        //echo $assign['lab_assign_date'];
        ?>
</div>
      </li> -->
      <?php 
        $query = "SELECT plc_user,plc_comment,plc_location,DATE_FORMAT(plc_tkh_upd,'%d/%m/%Y %h:%i:%s %p') AS tkh_upd FROM p_lab_comment\n                  WHERE plc_product_id='{$product_id}' ORDER BY plc_tkh_upd ASC";
        $result = selQuery($query);
        while ($rows = mysqli_fetch_assoc($result)) {
            ?>
      <li class="timeline-item">
        <div class="timeline-icon bg-primary light">
          <span class="fa fa-comments-o"></span>
        </div>
        <div class="timeline-desc">
          <div class="chat-widget">
            <div class="media" align="left">
              <div class="media-left">
                <i class="fa fa-user-md fa-3x text-primary"></i>
              </div>
              <div class="media-body" align="left">
                <h5 class="media-heading">
                  <small><?php 
            echo getUsername($rows['plc_user']) . " / " . getRole($rows['plc_location']);
            ?>
</small>
                </h5><?php 
//.........这里部分代码省略.........
开发者ID:syafiqazwan,项目名称:pharmaco,代码行数:101,代码来源:pkk.php


示例18: getUser

function getUser()
{
    return getRole(1);
}
开发者ID:dexz,项目名称:dev-extaze,代码行数:4,代码来源:admin_accounts.php


示例19: checkBoolPermission

function checkBoolPermission($action)
{
    global $db, $userdata, $lang;
    $role = getRole();
    switch ($action) {
        case 'VIEW_ALL':
            $sql = "SELECT view_all\r\n                          FROM " . AUCTION_ROLE_TABLE . "\r\n                          WHERE  auction_role_title='" . $role . "'";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not query role permissions', '', __LINE__, __FILE__, $sql);
            }
            // End if
            $row = $db->sql_fetchrow($result);
            if ($row['view_all'] == 0) {
                return 0;
            } else {
                return 1;
            }
            break;
        case 'VIEW_OFFER':
            $sql = "SELECT view_offer\r\n                          FROM " . AUCTION_ROLE_TABLE . "\r\n                          WHERE  auction_role_title='" . $role . "'";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not query role permissions', '', __LINE__, __FILE__, $sql);
            }
            // End if
            $row = $db->sql_fetchrow($result);
            if ($row['view_offer'] == 0) {
                return 0;
            } else {
                return 1;
            }
            break;
        case 'VIEW_BID_HISTORY':
            $sql = "SELECT view_bid_history\r\n                          FROM " . AUCTION_ROLE_TABLE . "\r\n                          WHERE  auction_role_title='" . $role . "'";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not query role permissions', '', __LINE__, __FILE__, $sql);
            }
            // End if
            $row = $db->sql_fetchrow($result);
            if ($row['view_bid_history'] == 0) {
                return 0;
            } else {
                return 1;
            }
            break;
        case 'NEW':
            $sql = "SELECT new\r\n                          FROM " . AUCTION_ROLE_TABLE . "\r\n                          WHERE  auction_role_title='" . $role . "'";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not query role permissions', '', __LINE__, __FILE__, $sql);
            }
            // End if
            $row = $db->sql_fetchrow($result);
            if ($row['new'] == 0) {
                return 0;
            } else {
                return 1;
            }
            break;
        case 'BID':
            $sql = "SELECT bid\r\n                          FROM " . AUCTION_ROLE_TABLE . "\r\n                          WHERE  auction_role_title='" . $role . "'";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not query role permissions', '', __LINE__, __FILE__, $sql);
            }
            // End if
            $row = $db->sql_fetchrow($result);
            if ($row['bid'] == 0) {
                return 0;
            } else {
                return 1;
            }
            break;
        case 'COMMENT':
            $sql = "SELECT comment\r\n                          FROM " . AUCTION_ROLE_TABLE . "\r\n                          WHERE  auction_role_title='" . $role . "'";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not query role permissions', '', __LINE__, __FILE__, $sql);
            }
            // End if
            $row = $db->sql_fetchrow($result);
            if ($row['comment'] == 0) {
                return 0;
            } else {
                return 1;
            }
            break;
        case 'MOVE':
            $sql = "SELECT move\r\n                          FROM " . AUCTION_ROLE_TABLE . "\r\n                          WHERE  auction_role_title='" . $role . "'";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not query role permissions', '', __LINE__, __FILE__, $sql);
            }
            // End if
            $row = $db->sql_fetchrow($result);
            if ($row['move'] == 0) {
                return 0;
            } else {
                return 1;
            }
            break;
        case 'DELETE_OFFER':
            $sql = "SELECT delete_offer\r\n                          FROM " . AUCTION_ROLE_TABLE . "\r\n                          WHERE  auction_role_title='" . $role . "'";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not query role permissions', '', __LINE__, __FILE__, $sql);
//.........这里部分代码省略.........
开发者ID:wrtcoder,项目名称:mini_isp,代码行数:101,代码来源:functions_general.php


示例20: updateRole

    $sql = "SELECT username, role FROM users WHERE id = {$id}";
    $result = $db->query($sql);
    $results = $result->fetch_assoc();
    return $results;
}
function updateRole($role, $id)
{
    $db = new mysqli(SERVERNAME, USERNAME, PASSWORD, DBNAME);
    $sql = "UPDATE users SET role='{$role}' WHERE id = {$id}";
    $result = $db->query($sql);
    $db->close();
}
if (isset($_POST['role'])) {
    $role = $_POST['role'];
    $id = $_POST['id'];
    updateRole($role, $id);
    header("Location: users.php");
}
if (isset($_GET['id'])) {
    $id = $_GET['id'];
    $results = getRole($id);
    $role = $results["role"];
    $username = $results["username"];
    if ($role == "admin") {
        $selected = '<option value="moderator">Moderator</option>
							<option selected="selected" value="admin">Admin</option>';
    } elseif ($role == "moderator") {
        $selected = '<option selected="selected" value="moderator">Moderator</option>
							<option value="admin">Admin</option>';
    }
}
开发者ID:RickjdeJong,项目名称:Doomla,代码行数:31,代码来源:edituser_logic.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getRoleCategory函数代码示例发布时间:2022-05-15
下一篇:
PHP getRevisions函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap