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


PHP check_user函数代码示例

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


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

示例1: register_user

function register_user()
{
    //  get passwordHash library for backwards compatability.
    require 'password.php';
    //  get database connection object
    require 'dbConnector.php';
    $db = loadDatabase();
    //  Get check_user function
    require 'check_user_db.php';
    //  get user submitted form
    $username = stripslashes($_POST['username']);
    $password = stripslashes($_POST['password']);
    $email = stripslashes($_POST['email']);
    //  Check if username exists using check_user()
    if (check_user($db, $username)) {
        $message = "Username '{$username}' already exists.";
    } else {
        //  hash and salt password
        $passwordHash = password_hash($password, PASSWORD_DEFAULT);
        // Prepared statement to insert a user
        $stmt = $db->prepare("INSERT INTO user (username, email, password)\n    VALUES (:username, :email, :passwordHash);");
        $stmt->bindValue(':username', $username);
        $stmt->bindValue(':passwordHash', $passwordHash);
        $stmt->bindValue(':email', $email);
        $stmt->execute();
        $_SESSION['logged_user'] = $username;
        $message = "{$username}, you are now registered.";
    }
    return $message;
}
开发者ID:bjhytrek,项目名称:BH,代码行数:30,代码来源:register_db.php

示例2: event_delete

function event_delete()
{
    global $config;
    if (!is_user() && $config['anon_permission'] < 2) {
        soft_error(_('You do not have permission to delete events.'));
    }
    $del_array = explode('&', $_SERVER['QUERY_STRING']);
    $html = tag('div', attributes('class="box"', 'style="width: 50%"'));
    $ids = 0;
    foreach ($del_array as $del_value) {
        list($drop, $id) = explode("=", $del_value);
        if (preg_match('/^id$/', $drop) == 0) {
            continue;
        }
        $ids++;
        $event = get_event_by_id($id);
        if (!check_user($event['uid']) && $config['anon_permission'] < 2) {
            $html->add(tag('p', _('You do not have permission to remove item') . ": {$id}"));
            continue;
        }
        if (remove_event($id)) {
            $html->add(tag('p', _('Removed item') . ": {$id}"));
        } else {
            $html->add(tag('p', _('Could not remove item') . ": {$id}"));
        }
    }
    if ($ids == 0) {
        $html->add(tag('p', _('No items selected.')));
    }
    return $html;
}
开发者ID:noprom,项目名称:cryptdb,代码行数:31,代码来源:event_delete.php

示例3: array_menu

 function array_menu($parent_id = 0, $group_id = 2, $close = array())
 {
     $ci =& get_instance();
     if ($group_id == 'all') {
         $query = "SELECT \n\t\t\t\t\t\t\tsys_menu.*,sys_resources.name AS permission \n\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\tsys_menu \n\t\t\t\t\t\tLEFT JOIN sys_resources ON(sys_menu.resources_id=sys_resources.id) \n\t\t\t\t\t  \tWHERE sys_menu.parent_id = {$parent_id} \n\t\t\t\t\t\tORDER BY sys_menu.id ASC";
     } else {
         $query = "SELECT \n\t\t\t\t\t\t\tsys_menu.*,sys_resources.name AS permission \n\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\tsys_menu \n\t\t\t\t\t\tLEFT JOIN sys_resources ON(sys_menu.resources_id=sys_resources.id) \n\t\t\t\t\t  \tWHERE sys_menu.parent_id = {$parent_id} AND sys_menu.group_id = {$group_id} \n\t\t\t\t\t\tORDER BY sys_menu.id ASC";
     }
     $result = $ci->db->query($query);
     $data = array();
     if ($result->num_rows() > 0) {
         foreach ((array) $result->result_array() as $row) {
             $allow_menu = check_user($row['permission'], false);
             if ($allow_menu) {
                 $r['id'] = $row['id'];
                 $r['parent_id'] = $row['parent_id'];
                 $r['text'] = strtoupper($row['name']);
                 $r['url'] = $row['url'];
                 $r['state'] = $close && in_array($row['id'], $close) ? 'closed' : '';
                 $r['children'] = array_menu($row['id'], $group_id, $close);
                 $data[] = $r;
             }
         }
     }
     return $data;
 }
开发者ID:allfonso,项目名称:simpeg2,代码行数:26,代码来源:menu_helper.php

示例4: add_user

function add_user($way, $login)
{
    global $db;
    if (check_user($way, $login)) {
        return false;
    }
    $result = $db->insert("user", "`way`,`login`", "'{$way}','{$login}'");
    return $result;
}
开发者ID:jinguanio,项目名称:onlinedict,代码行数:9,代码来源:functions.php

示例5: __construct

 public function __construct()
 {
     parent::__construct();
     $this->table = 'sys_menu';
     $this->primary = 'id';
     $this->load->config('glyphicon');
     $this->glyphicon = $this->config->item('glyphicon');
     $this->load->model('cpanel/menu_model');
     $this->load->library('tree');
     check_user('menu.manager');
 }
开发者ID:unregister,项目名称:tutupgelas,代码行数:11,代码来源:menu.php

示例6: __construct

 function __construct()
 {
     parent::__construct();
     $this->user_table = 'sys_users';
     $this->user_primary = 'id';
     $this->role_table = 'sys_roles';
     $this->role_primary = 'id';
     $this->role_field_name = 'name';
     $this->load->model('dx_auth/permissions', 'permissions');
     check_user('user.manager');
 }
开发者ID:unregister,项目名称:tutupgelas,代码行数:11,代码来源:user.php

示例7: checkQueue

 /**
  * Buguser protection
  */
 protected function checkQueue()
 {
     global $user;
     check_user();
     // check
     $sql = "SELECT * FROM ugml_galactic_jump_queue\r\n\t\t\t\tWHERE userID = " . WCF::getUser()->userID;
     $result = WCF::getDB()->getResultList($sql);
     $this->fleet = unserialize($result[0]['ships']);
     //if(count($result) != 1 || $result[0]['time'] != $user['onlinetime'] || $result[0]['state'] != 2) message('Bug-User-Schutz, bitte erneut losschicken!');
     // save
     $sql = "UPDATE ugml_galactic_jump_queue\r\n\t\t\t\tSET endPlanetID = " . $this->moonObj->planetID . ",\r\n\t\t\t\t\tstate = 3,\r\n\t\t\t\t\ttime = " . TIME_NOW . "\r\n\t\t\t\tWHERE queueID = " . $result[0]['queueID'];
     WCF::getDB()->registerShutdownUpdate($sql);
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:16,代码来源:GalacticJumpResourcesPage.class.php

示例8: settings

 public function settings()
 {
     check_user('testimonial.settings');
     $this->crud->set_table('testimonial_settings');
     $this->crud->set_primary_key('id');
     $this->crud->set_subject('Settings Testimonial');
     $this->crud->edit_fields('success_messages', 'error_messages', 'show_phone', 'show_website', 'show_location', 'show_images', 'show_captcha', 'required_phone', 'required_website', 'required_location', 'required_images');
     $this->crud->display_as('success_messages', 'Pesan sukses');
     $this->crud->display_as('error_messages', 'Pesan error');
     $this->crud->field_type('show_phone', 'true_false', array('1' => 'Ya', '0' => 'Tidak'));
     $this->crud->field_type('show_website', 'true_false', array('1' => 'Ya', '0' => 'Tidak'));
     $this->crud->field_type('show_location', 'true_false', array('1' => 'Ya', '0' => 'Tidak'));
     $this->crud->field_type('show_images', 'true_false', array('1' => 'Ya', '0' => 'Tidak'));
     $this->crud->field_type('show_captcha', 'true_false', array('1' => 'Ya', '0' => 'Tidak'));
     $this->crud->display_as('show_phone', 'Tampilkan form phone');
     $this->crud->display_as('show_website', 'Tampilkan form website');
     $this->crud->display_as('show_location', 'Tampilkan form lokasi');
     $this->crud->display_as('show_images', 'Tampikan form photo');
     $this->crud->display_as('show_captcha', 'Tampilkan form captcha');
     $this->crud->field_type('required_name', 'true_false', array('1' => 'Ya', '0' => 'Tidak'));
     $this->crud->field_type('required_email', 'true_false', array('1' => 'Ya', '0' => 'Tidak'));
     $this->crud->field_type('required_phone', 'true_false', array('1' => 'Ya', '0' => 'Tidak'));
     $this->crud->field_type('required_website', 'true_false', array('1' => 'Ya', '0' => 'Tidak'));
     $this->crud->field_type('required_location', 'true_false', array('1' => 'Ya', '0' => 'Tidak'));
     $this->crud->field_type('required_images', 'true_false', array('1' => 'Ya', '0' => 'Tidak'));
     $this->crud->display_as('required_name', 'Form Nama wajib di isi?');
     $this->crud->display_as('required_email', 'Form Email wajib di isi?');
     $this->crud->display_as('required_phone', 'Form Phone wajib di isi?');
     $this->crud->display_as('required_website', 'Form Website wajib di isi?');
     $this->crud->display_as('required_location', 'Form Lokasi wajib di isi?');
     $this->crud->display_as('required_images', 'Form Photo wajib di isi?');
     $this->crud->unset_list();
     $this->crud->unset_add();
     $this->crud->unset_delete();
     $this->crud->unset_back_to_list();
     try {
         $output = $this->crud->render();
     } catch (Exception $e) {
         if ($e->getCode() == 14) {
             redirect('testimonial/admin/testimonial/settings/edit/1');
             exit;
         } else {
             show_error($e->getMessage());
         }
     }
     $data['output'] = $output;
     $data['page'] = "layout_crud";
     $data['module'] = $this->module;
     $data['title'] = "Testimonial manager";
     $this->load->view($this->layout, $data);
 }
开发者ID:unregister,项目名称:tutupgelas,代码行数:51,代码来源:testimonial.php

示例9: login

function login()
{
    try {
        $user = $_POST['user'];
        $hashPass = md5($_POST['pass']);
        if (check_user($user, $hashPass)) {
            return "true";
        } else {
            return "Invalid UserName or Password";
        }
    } catch (PDOException $e) {
        echo $e->getMessage();
    }
}
开发者ID:joaoacsoares,项目名称:LTW,代码行数:14,代码来源:login.php

示例10: valid_user

/**
 * valid_user	Check if connection to the API is correct.
 * 						If connection is correct, check if a user exists on the wiki.
 *						Called by 'validuser' action parameter
 *
 * @param		string	$webserviceid	id to the webservice
 * @param		string	$webservicepass	password to the webservice
 * @param		string	$username	user id
 * @param		string	$userpass	user password
 * 
 * @return	string	result message:
 *									- 'Success' if user exists
 *									- Error message otherwise
 */
function valid_user($webserviceid, $webservicepass, $username, $userpass)
{
    // Result structure to send back
    $result = array('validuser' => array('username' => $username, 'result' => 'undefined'));
    // Check webservice connection
    $webservice_result = check_webservice($webserviceid, $webservicepass);
    if ($webservice_result != null) {
        // Incorrect webservice connection
        $result['validuser']['result'] = $webservice_result;
    } else {
        // Webservice connection ok: check user
        $result['validuser']['result'] = check_user($username, $userpass);
    }
    return json_encode($result);
}
开发者ID:Atlasmuseum,项目名称:AM,代码行数:29,代码来源:API_ValidUser.php

示例11: index

 public function index()
 {
     $html = "<script type=\"text/javascript\">\n";
     $html .= "\$(document).ready(function(){\t\$('#field-title').friendurl({id : 'field-seo', divider: '-'}); });";
     $html .= "</script>";
     $allow_add = check_user('post.add', FALSE);
     $allow_edit = check_user('post.edit', FALSE);
     $allow_delete = check_user('post.delete', FALSE);
     $this->crud->set_table('content');
     $this->crud->where('type_id', 2);
     $this->crud->set_subject('Data post');
     $this->crud->required_fields('title', 'content');
     $this->crud->field_type('active', 'true_false', array('1' => 'Yes', '0' => 'No'));
     $this->crud->field_type('created', 'hidden', date('Y-m-d H:i:s'));
     $this->crud->unset_add_fields('meta_title', 'hits');
     $this->crud->unset_edit_fields('meta_title', 'hits', 'created_by', 'created', 'type_id');
     $this->crud->columns('title', 'category_id', 'seo', 'created_by', 'created');
     $this->crud->field_type('type_id', 'hidden', 2);
     $this->crud->set_field_upload('image', 'files/post');
     $state = $this->crud->getState();
     if ($state == 'ajax_list') {
         $this->crud->set_relation('created_by', 'sys_users', 'name');
     } else {
         $this->crud->field_type('created_by', 'hidden', $this->user->user_id);
     }
     $this->crud->set_relation('category_id', 'content_category', 'name');
     $this->crud->display_as('category_id', 'Kategori');
     if (!$allow_add) {
         $this->crud->unset_add();
     }
     if (!$allow_edit) {
         $this->crud->unset_edit();
     }
     if (!$allow_delete) {
         $this->crud->unset_delete();
     }
     $this->crud->field_type('meta_description', 'text');
     $this->crud->unset_texteditor('meta_description');
     $output = $this->crud->render();
     $data['title'] = "Post";
     $data['js'] = array(_ASSET_URL . "js/jquery.friendurl.min.js");
     $data['html'] = $html;
     $data['output'] = $output;
     $data['page'] = "layout_crud";
     $data['module'] = "post";
     $this->load->view($this->layout, $data);
 }
开发者ID:unregister,项目名称:tutupgelas,代码行数:47,代码来源:post.php

示例12: index

 public function index()
 {
     check_user('client.data');
     $this->crud->set_table("client");
     $this->crud->set_subject('Data client');
     $this->crud->set_field_upload('client_image', 'files/client');
     $this->crud->field_type('client_active', 'true_false', array('1' => 'Yes', '0' => 'No'));
     $this->crud->display_as('client_name', 'Nama');
     $this->crud->display_as('client_website', 'Webiste');
     $this->crud->display_as('client_image', 'Gambar');
     $this->crud->display_as('client_description', 'Deskripsi');
     $this->crud->display_as('client_active', 'Aktif');
     $output = $this->crud->render();
     $data['output'] = $output;
     $data['title'] = "Data Klien";
     $data['module'] = "client";
     $data['page'] = "layout_crud";
     $this->load->view($this->layout, $data);
 }
开发者ID:unregister,项目名称:tutupgelas,代码行数:19,代码来源:client.php

示例13: checkQueue

 /**
  * Buguser protection
  */
 protected function checkQueue()
 {
     global $user;
     check_user();
     if (LWCore::getPlanet()->galactic_jump_time > TIME_NOW) {
         message('Sprungtor noch nicht abgekühlt! (Restdauer: ' . gmdate('G:i:s)', LWCore::getPlanet()->galactic_jump_time - TIME_NOW));
     }
     if (LWCore::getPlanet()->planet_type != 3 || LWCore::getPlanet()->quantic_jump <= 0) {
         message('Kein Sprungtor vorhanden!');
     }
     // check
     $sql = "SELECT * FROM ugml_galactic_jump_queue\r\n\t\t\t\tWHERE userID = " . WCF::getUser()->userID;
     $result = WCF::getDB()->getResultList($sql);
     //if(count($result) != 1 || $result[0]['time'] != $user['onlinetime'] || $result[0]['state'] != 1) message('Bug-User-Schutz, bitte erneut losschicken!');
     // save
     $shipStr = serialize($this->fleet);
     $sql = "UPDATE ugml_galactic_jump_queue\r\n\t\t\t\tSET ships = '" . $shipStr . "',\r\n\t\t\t\t\tstate = 2,\r\n\t\t\t\t\ttime = " . TIME_NOW . "\r\n\t\t\t\tWHERE queueID = " . $result[0]['queueID'];
     WCF::getDB()->registerShutdownUpdate($sql);
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:22,代码来源:GalacticJumpPage.class.php

示例14: checkQueue

 /**
  * Buguser protection
  */
 protected function checkQueue()
 {
     global $resource, $user;
     check_user();
     // check
     $sql = "SELECT * FROM ugml_galactic_jump_queue\n\t\t\t\tWHERE userID = " . WCF::getUser()->userID;
     $result = WCF::getDB()->getResultList($sql);
     if (count($result) != 1 || $result[0]['time'] != $user['onlinetime'] || $result[0]['state'] != 3) {
         message('Bug-User-Schutz, bitte erneut losschicken!');
     }
     $this->fleet = unserialize($result[0]['ships']);
     foreach ($this->fleet as $shipTypeID => $count) {
         if (LWCore::getPlanet()->{$resource[$shipTypeID]} < $count) {
             message('Zu viele Schiffe ausgew&auml;hlt!');
         }
     }
     $this->moonObj = Planet::getInstance($result[0]['endPlanetID']);
     // save
     $sql = "DELETE FROM ugml_galactic_jump_queue\n\t\t\t\tWHERE queueID = " . $result[0]['queueID'];
     WCF::getDB()->registerShutdownUpdate($sql);
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:24,代码来源:GalacticJumpAction.class.php

示例15: define

    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    WOT Game is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with WOT Game.  If not, see <http://www.gnu.org/licenses/>.
*/
define('INSIDE', true);
$ugamela_root_path = '../';
include $ugamela_root_path . 'extension.inc';
include $ugamela_root_path . 'common.' . $phpEx;
if (!check_user()) {
    header("Location: login.php");
    die;
}
require_once WCF_DIR . 'lib/util/ArrayUtil.class.php';
require_once LW_DIR . 'lib/data/account/PBU.class.php';
// TODO: dirty :(
if (!defined('SERVER_ID')) {
    define('SERVER_ID', 0);
}
if (isset($_REQUEST['userID'])) {
    $userID = intval($_REQUEST['userID']);
    pbuUser($userID);
} else {
    if (isset($_REQUEST['userIDs'])) {
        $userIDs = explode(',', $_REQUEST['userIDs']);
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:manualPBU.php


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