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


PHP UserUtils::username_exists方法代码示例

本文整理汇总了PHP中UserUtils::username_exists方法的典型用法代码示例。如果您正苦于以下问题:PHP UserUtils::username_exists方法的具体用法?PHP UserUtils::username_exists怎么用?PHP UserUtils::username_exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserUtils的用法示例。


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

示例1: check_var

* @package
*/
require_once '../include/sysadmin_auth.inc';
require_once '../include/errors.inc';
require_once '../include/demo_replace.inc';
require_once '../classes/userutils.class.php';
$userID = check_var('userID', 'GET', true, false, true);
$errors = false;
$user_details = UserUtils::get_user_details($userID, $mysqli);
if ($user_details === false) {
    $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
    $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
}
if (isset($_POST['submit']) and $_POST['username'] != $_POST['prev_username']) {
    // Check new username is not already used. Overwriting usernames could screw up other accounts.
    if (UserUtils::username_exists($_POST['username'], $mysqli)) {
        $errors = 'Username exists';
    }
}
if (isset($_POST['submit']) and !$errors) {
    $cfg_web_root = $configObject->get('cfg_web_root');
    if (!empty($_FILES['photofile']['name'])) {
        $filename = $_FILES['photofile']['name'];
        $explode = explode('.', $filename);
        $count = count($explode) - 1;
        $file_ext = $explode[$count];
        if (!move_uploaded_file($_FILES['photofile']['tmp_name'], $cfg_web_root . 'users/photos/' . $_POST['username'] . '.' . $file_ext)) {
            log_error($userObject->get_user_ID(), 'Edit User', 'Application Error', 'Error uploading user photo - error: ' . $_FILES['photofile']['error'], $_SERVER['PHP_SELF'], 49, '', null, null, null);
        }
    }
    $initials = '';
开发者ID:vinod-co,项目名称:centa,代码行数:31,代码来源:edit_details.php

示例2: explode

 $cols = explode(',', $separate_line);
 if ($line_no == 0) {
     // Read the header row
     $heading = $cols;
     $col_no = count($cols);
     echo "<tr><th></th><th>Username</th><th colspan=\"3\">Student Name</th>";
     for ($i = 1; $i < $col_no; $i++) {
         echo "<th>" . trim($heading[$i]) . "</th>";
     }
     echo "</tr>\n";
 } else {
     // 'username' can be either the real username or sid
     $username = trim($cols[0]);
     // Check see if user was found
     if (!isset($student_id_array[$username])) {
         if (UserUtils::userid_exists($username, $mysqli) or UserUtils::username_exists($username, $mysqli)) {
             echo "<tr><td><img src=\"../artwork/red_cross_16.png\" wodth=\"16\" height=\"16\" alt=\"Failed\" /></td><td class=\"failed\">{$username}</td><td colspan=\"" . (3 + $col_no) . "\" class=\"failed\" style=\"text-align:center\">&lt;user not registered on " . module_utils::get_moduleid_from_id($_GET['module'], $mysqli) . "&gt;</td>";
         } else {
             echo "<tr><td><img src=\"../artwork/red_cross_16.png\" wodth=\"16\" height=\"16\" alt=\"Failed\" /></td><td class=\"failed\">{$username}</td><td colspan=\"" . (3 + $col_no) . "\" class=\"failed\" style=\"text-align:center\">&lt;unknown user&gt;</td>";
         }
     } else {
         $student_id = $student_id_array[$username];
         echo "<tr><td><img src=\"../artwork/green_plus_16.png\" wodth=\"16\" height=\"16\" alt=\"Add\" /></td><td>{$username}</td><td>" . $student_data[$student_id]['title'] . "</td><td>" . $student_data[$student_id]['surname'] . "</td><td>" . $student_data[$student_id]['first_names'] . "</td>";
         for ($i = 1; $i < $col_no; $i++) {
             $type = trim($heading[$i]);
             $value = trim($cols[$i]);
             echo "<td>{$value}</td>";
             if ($type != '') {
                 $stmt->execute();
             }
         }
开发者ID:vinod-co,项目名称:centa,代码行数:31,代码来源:import_users_metadata.php

示例3: MAX

 $new_moduleid = '';
 $result = $mysqli->prepare("SELECT MAX(id) FROM modules");
 $result->execute();
 $result->store_result();
 $result->bind_result($maxmodid);
 $result->fetch();
 $result->close();
 for ($a = 0; $a < strlen($_POST['new_grade2']); $a++) {
     $b = substr($_POST['new_grade2'], $a, 1);
     if (ctype_upper($b) or ctype_digit($b)) {
         $new_moduleid = $new_moduleid . $b;
     }
 }
 $new_moduleid = $new_moduleid . $maxmodid;
 // Check for unique username
 if (UserUtils::username_exists($_POST['new_username'], $mysqli) or UserUtils::username_exists($_POST['new_username'] . '-stu', $mysqli)) {
     $unique_username = false;
 } else {
     $unique_username = true;
 }
 $schoolID = SchoolUtils::add_school(1, 'School of Practice', $mysqli);
 // Make sure the 'School of Practice' school exists.
 CourseUtils::add_course($schoolID, 'A10DEMO', 'Demonstration BSc', $mysqli);
 // Make sure demo course exists.
 $new_modid = module_utils::add_modules($new_moduleid, $_POST['new_grade2'], 1, $schoolID, NULL, NULL, true, true, true, false, false, true, false, $mysqli, 0, 0, 1, 1, '07/01');
 if ($unique_username == true) {
     $_POST['new_grade'] = $new_moduleid;
     $session = date_utils::get_current_academic_year();
     // Add staff account
     $new_username = trim($_POST['new_username']);
     $useridstf = adduser('Staff', 'Staff', $new_username, $mysqli);
开发者ID:vinod-co,项目名称:centa,代码行数:31,代码来源:register.php

示例4: switch

*
* Creates a new user (staff or student).
*
* @author Simon Wilkinson
* @version 1.0
* @copyright Copyright (c) 2014 The University of Nottingham
* @package
*/
require_once '../include/admin_auth.inc';
require_once '../include/mb_string.inc.php';
require_once '../classes/userutils.class.php';
$unique_username = true;
$problem = false;
if (isset($_POST['submit'])) {
    // Check for unique username
    if (UserUtils::username_exists($_POST['new_username'], $mysqli) !== false) {
        $unique_username = false;
        $problem = true;
    }
    switch ($_POST['new_grade']) {
        case 'University Lecturer':
        case 'University Admin':
        case 'Technical Staff':
        case 'NHS Lecturer':
        case 'NHS Admin':
            $tmp_roles = 'Staff';
            break;
        case 'Invigilator':
            $tmp_roles = 'Invigilator';
            break;
        case 'Staff External Examiner':
开发者ID:vinod-co,项目名称:centa,代码行数:31,代码来源:create_new_user.php


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