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


PHP check_username函数代码示例

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


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

示例1: signup

function signup($first_name, $last_name, $email, $password1, $password2, $user_name)
{
    global $db;
    //echo ' Signup Function Entered ';
    //check if passwords match
    //echo ' checking password ';
    if ($password1 != $password2) {
        //echo 'password';
        return 'password';
    }
    //check if email is in the system already
    //echo ' checking email ';
    $bad_email = check_email($email);
    if ($bad_email) {
        //echo 'email';
        return 'email';
    }
    //check if username already exists
    //echo ' checking username ';
    $bad_username = check_username($user_name);
    if ($bad_username) {
        //echo ' username ';
        return 'username';
    }
    $user_type = 'user';
    //echo ' Starting query ';
    //echo ' attempting password hash ';
    $hashed_password = password_hash($password1, PASSWORD_BCRYPT);
    //echo ' password hash successful ';
    $query = 'INSERT INTO users VALUES (NULL, :user_type, :first_name, :last_name, :email, :user_name, :password, NULL)';
    $statement = $db->prepare($query);
    $statement->bindValue(':user_type', $user_type);
    $statement->bindValue(':first_name', $first_name);
    $statement->bindValue(':last_name', $last_name);
    $statement->bindValue(':email', $email);
    $statement->bindValue(':user_name', $user_name);
    $statement->bindValue(':password', $hashed_password);
    //var_dump($statement);
    //echo 'Query Ready';
    try {
        //echo 'Attempting query';
        $statement->execute();
        //echo 'success';
        return 'success';
    } catch (PDOException $ex) {
        //echo 'database error';
        //echo $ex;
        return 'error';
    }
}
开发者ID:Dorely,项目名称:WebDevelopment,代码行数:50,代码来源:account.php

示例2: sendVerify

 /**
  * sendVerify 发送验证码
  * @author:xjw129xjt(肖骏涛) xjt@ourstu.com
  */
 public function sendVerify()
 {
     $aAccount = $cUsername = I('post.account', '', 'op_t');
     $aType = I('post.type', '', 'op_t');
     $aType = $aType == 'mobile' ? 'mobile' : 'email';
     $aAction = I('post.action', 'config', 'op_t');
     if (!check_reg_type($aType)) {
         $str = $aType == 'mobile' ? L('_PHONE_') : L('_EMAIL_');
         $this->error($str . L('_ERROR_OPTIONS_CLOSED_') . L('_EXCLAMATION_'));
     }
     if (empty($aAccount)) {
         $this->error(L('_ERROR_ACCOUNT_CANNOT_EMPTY_'));
     }
     check_username($cUsername, $cEmail, $cMobile);
     $time = time();
     if ($aType == 'mobile') {
         $resend_time = modC('SMS_RESEND', '60', 'USERCONFIG');
         if ($time <= session('verify_time') + $resend_time) {
             $this->error(L('_ERROR_WAIT_1_') . ($resend_time - ($time - session('verify_time'))) . L('_ERROR_WAIT_2_'));
         }
     }
     if ($aType == 'email' && empty($cEmail)) {
         $this->error(L('_ERROR__EMAIL_'));
     }
     if ($aType == 'mobile' && empty($cMobile)) {
         $this->error(L('_ERROR_PHONE_'));
     }
     $checkIsExist = UCenterMember()->where(array($aType => $aAccount))->find();
     if ($checkIsExist) {
         $str = $aType == 'mobile' ? L('_PHONE_') : L('_EMAIL_');
         $this->error(L('_ERROR_USED_1_') . $str . L('_ERROR_USED_2_') . L('_EXCLAMATION_'));
     }
     $verify = D('Verify')->addVerify($aAccount, $aType);
     if (!$verify) {
         $this->error(L('_ERROR_FAIL_SEND_') . L('_EXCLAMATION_'));
     }
     $res = A(ucfirst($aAction))->doSendVerify($aAccount, $verify, $aType);
     if ($res === true) {
         if ($aType == 'mobile') {
             session('verify_time', $time);
         }
         $this->success(L('_ERROR_SUCCESS_SEND_'));
     } else {
         $this->error($res);
     }
 }
开发者ID:naliduo,项目名称:Lightweight-social-platform,代码行数:50,代码来源:VerifyController.class.php

示例3: sendVerify

 /**
  * sendVerify 发送验证码
  * @author:xjw129xjt(肖骏涛) xjt@ourstu.com
  */
 public function sendVerify()
 {
     $aAccount = $cUsername = I('post.account', '', 'op_t');
     $aType = I('post.type', '', 'op_t');
     $aType = $aType == 'mobile' ? 'mobile' : 'email';
     $aAction = I('post.action', 'config', 'op_t');
     if (!check_reg_type($aType)) {
         $str = $aType == 'mobile' ? '手机' : '邮箱';
         $this->error($str . '选项已关闭!');
     }
     if (empty($aAccount)) {
         $this->error('帐号不能为空');
     }
     check_username($cUsername, $cEmail, $cMobile);
     $time = time();
     if ($aType == 'mobile') {
         $resend_time = modC('SMS_RESEND', '60', 'USERCONFIG');
         if ($time <= session('verify_time') + $resend_time) {
             $this->error('请' . ($resend_time - ($time - session('verify_time'))) . '秒后再发');
         }
     }
     if ($aType == 'email' && empty($cEmail)) {
         $this->error('请验证邮箱格式是否正确');
     }
     if ($aType == 'mobile' && empty($cMobile)) {
         $this->error('请验证手机格式是否正确');
     }
     $checkIsExist = UCenterMember()->where(array($aType => $aAccount))->find();
     if ($checkIsExist) {
         $str = $aType == 'mobile' ? '手机' : '邮箱';
         $this->error('该' . $str . '已被其他用户使用!');
     }
     $verify = D('Verify')->addVerify($aAccount, $aType);
     if (!$verify) {
         $this->error('发送失败!');
     }
     $res = A(ucfirst($aAction))->doSendVerify($aAccount, $verify, $aType);
     if ($res === true) {
         if ($aType == 'mobile') {
             session('verify_time', $time);
         }
         $this->success('发送成功,请查收');
     } else {
         $this->error($res);
     }
 }
开发者ID:ccccy,项目名称:wuanlife,代码行数:50,代码来源:VerifyController.class.php

示例4: _validate_fields

function _validate_fields($real_name, $username, $userpass, $userpass2, $email, $email2, $email_updates)
{
    global $testing;
    // Make sure that password and confirmed password are equal.
    if ($userpass != $userpass2) {
        return _("The passwords you entered were not equal.");
    }
    // Make sure that email and confirmed email are equal.
    if ($email != $email2) {
        return _("The e-mail addresses you entered were not equal.");
    }
    // Do some validity-checks on inputted username, password, e-mail and real name
    $err = check_username($username, TRUE);
    if ($err != '') {
        return $err;
    }
    // In testing mode, a fake email address is constructed using
    // 'localhost' as the domain. check_email_address() incorrectly
    // thinks the domain should end in a 2-4 character top level
    // domain, so disable the address check for testing.
    if (!$testing) {
        $err = check_email_address($email);
        if ($err != '') {
            return $err;
        }
    }
    if (empty($userpass) || empty($real_name)) {
        return _("You did not completely fill out the form.");
    }
    // Make sure that the requested username is not already taken.
    // Use non-strict validation, which will return TRUE if the username
    // is the same as an existing one, or differs only by case or trailing
    // whitespace.
    if (User::is_valid_user($username, FALSE)) {
        return _("That user name already exists, please try another.");
    }
    // TODO: The above check only validates against users in the DP database.
    // It's possible that there are usernames already registered with the
    // underlying forum software (like 'Anonymous') or are disallowed in the
    // forum software which, if used, will cause account creation to fail in
    // activate.php.
    return '';
}
开发者ID:cpeel,项目名称:dproofreaders-shadow,代码行数:43,代码来源:addproofer.php

示例5: sendVerify

 /**
  * sendVerify 发送验证码
  * @author:xjw129xjt(肖骏涛) xjt@ourstu.com
  */
 public function sendVerify()
 {
     $aAccount = $cUsername = I('post.account', '', 'op_t');
     #=》获取邮件地址或是手机号码
     $aType = I('post.type', '', 'op_t');
     $aType = $aType == 'mobile' ? 'mobile' : 'email';
     #=》获取注册的方式,邮件或是手机
     $aAction = I('post.action', 'config', 'op_t');
     if (!check_reg_type($aType)) {
         $str = $aType == 'mobile' ? '手机' : '邮箱';
         $this->error($str . '选项已关闭!');
     }
     if (empty($aAccount)) {
         $this->error('帐号不能为空');
     }
     check_username($cUsername, $cEmail, $cMobile, $cCompany);
     if ($aType == 'email' && empty($cEmail)) {
         $this->error('请验证邮箱格式是否正确');
     }
     if ($aType == 'mobile' && empty($cMobile)) {
         $this->error('请验证手机格式是否正确');
     }
     $checkIsExist = UCenterMember()->where(array($aType => $aAccount))->find();
     if ($checkIsExist) {
         $str = $aType == 'mobile' ? '手机' : '邮箱';
         $this->error('该' . $str . '已被其他用户使用!');
     }
     #=>添加一条验证记录,并返回产生的随机数
     $verify = D('Verify')->addVerify($aAccount, $aType);
     if (!$verify) {
         $this->error('发送失败!');
     }
     #=> 实例化当前模块的控制器
     $res = A(ucfirst($aAction))->doSendVerify($aAccount, $verify, $aType);
     if ($res === true) {
         $this->success('发送成功,请查收');
     } else {
         $this->error($res);
     }
 }
开发者ID:qimeijun,项目名称:OCenter,代码行数:44,代码来源:VerifyController.class.php

示例6: get_shared_data

 function get_shared_data($user)
 {
     global $mysql, $username;
     # does the user exist in the database?
     if (check_username($user)) {
         $this->foreign_username = $user;
     } else {
         $this->foreign_username = $username;
     }
     # get all shared folders for the given user
     $query = "SELECT id, childof, name, public FROM folder WHERE public='1' AND deleted!='1' AND user='{$this->foreign_username}' ORDER BY name";
     if ($mysql->query($query)) {
         # make two arrays:
         # 1) $children containing arrays with children. the keys of these arrays are the id's of the parents
         # 2) $folders containing arrays with folder settings (id, childof, name, public)
         $shared_children = array();
         while ($row = mysql_fetch_assoc($mysql->result)) {
             $this->folders[$row['id']] = $row;
             if (!isset($this->children[$row['childof']])) {
                 $this->children[$row['childof']] = array();
             }
             array_push($this->children[$row['childof']], $row['id']);
             array_push($shared_children, $row['id']);
         }
         $this->children[0] = array();
         # the childof fields of each folder with no parent is being set to 0, so it becomes a child of the root folder
         foreach ($this->folders as $value) {
             if (in_array($value['childof'], $shared_children)) {
                 continue;
             } else {
                 array_push($this->children[0], $value['id']);
                 $this->folders[$value['id']]['childof'] = 0;
             }
         }
     } else {
         message($mysql->error);
     }
 }
开发者ID:roxine9,项目名称:online-bookmarks,代码行数:38,代码来源:folders.php

示例7: getLocal

 public function getLocal($username, $password)
 {
     $aUsername = $username;
     check_username($aUsername, $email, $mobile, $type);
     $map = array();
     switch ($type) {
         case 1:
             $map['username'] = $username;
             break;
         case 2:
             $map['email'] = $username;
             break;
         case 3:
             $map['mobile'] = $username;
             break;
         case 4:
             $map['id'] = $username;
             break;
         default:
             return 0;
             //参数错误
     }
     /* 获取用户数据 */
     $user = $this->where($map)->find();
     if (is_array($user) && $user['status']) {
         /* 验证用户密码 */
         if (think_ucenter_md5($password, UC_AUTH_KEY) === $user['password']) {
             return $user;
             //登录成功,返回用户ID
         } else {
             return false;
             //密码错误
         }
     } else {
         return false;
         //用户不存在或被禁用
     }
 }
开发者ID:ccccy,项目名称:wuanlife,代码行数:38,代码来源:UcenterMemberModel.class.php

示例8: save_profile

function save_profile()
{
    global $db, $user, $current_user, $globals, $admin_mode, $site_key, $bio_max;
    $errors = 0;
    // benjami: control added (2005-12-22)
    $new_pass = false;
    $messages = array();
    $form_hash = md5($site_key . $user->id . $current_user->user_id);
    if (isset($_POST['disabledme']) && intval($_POST['disable']) == 1 && $_POST['form_hash'] == $form_hash && $_POST['user_id'] == $current_user->user_id) {
        $old_user_login = $user->username;
        $old_user_id = $user->id;
        $user->disable(true);
        Log::insert('user_delete', $old_user_id, $old_user_id);
        syslog(LOG_NOTICE, "Meneame, disabling {$old_user_id} ({$old_user_login}) by {$current_user->user_login} -> {$user->username} ");
        $current_user->Logout(get_user_uri($user->username));
        die;
    }
    if (!isset($_POST['save_profile']) || !isset($_POST['process']) || $_POST['user_id'] != $current_user->user_id && !$admin_mode) {
        return;
    }
    if (empty($_POST['form_hash']) || $_POST['form_hash'] != $form_hash) {
        array_push($messages, _('Falta la clave de control'));
        $errors++;
    }
    if (!empty($_POST['username']) && trim($_POST['username']) != $user->username) {
        $newname = trim($_POST['username']);
        if (strlen($newname) < 3) {
            array_push($messages, _('nombre demasiado corto'));
            $errors++;
        }
        if (!check_username($newname)) {
            array_push($messages, _('nombre de usuario erróneo, caracteres no admitidos'));
            $errors++;
        } elseif (user_exists($newname, $user->id)) {
            array_push($messages, _('el usuario ya existe'));
            $errors++;
        } else {
            $user->username = $newname;
        }
    }
    if (!empty($_POST['bio']) || $user->bio) {
        $bio = clean_text($_POST['bio'], 0, false, $bio_max);
        if ($bio != $user->bio) {
            $user->bio = $bio;
        }
    }
    if ($user->email != trim($_POST['email']) && !check_email(trim($_POST['email']))) {
        array_push($messages, _('el correo electrónico no es correcto'));
        $errors++;
    } elseif (!$admin_mode && trim($_POST['email']) != $current_user->user_email && email_exists(trim($_POST['email']), false)) {
        array_push($messages, _('ya existe otro usuario con esa dirección de correo'));
        $errors++;
    } else {
        $user->email = trim($_POST['email']);
    }
    $user->url = htmlspecialchars(clean_input_url($_POST['url']));
    // Check IM address
    if (!empty($_POST['public_info'])) {
        $_POST['public_info'] = htmlspecialchars(clean_input_url($_POST['public_info']));
        $public = $db->escape($_POST['public_info']);
        $im_count = intval($db->get_var("select count(*) from users where user_id != {$user->id} and user_level != 'disabled' and user_level != 'autodisabled' and user_public_info='{$public}'"));
        if ($im_count > 0) {
            array_push($messages, _('ya hay otro usuario con la misma dirección de MI, no se ha grabado'));
            $_POST['public_info'] = '';
            $errors++;
        }
    }
    $user->phone = $_POST['phone'];
    $user->public_info = htmlspecialchars(clean_input_url($_POST['public_info']));
    // End check IM address
    if ($user->id == $current_user->user_id) {
        // Check phone number
        if (!empty($_POST['phone'])) {
            if (!preg_match('/^\\+[0-9]{9,16}$/', $_POST['phone'])) {
                array_push($messages, _('número telefónico erróneo, no se ha grabado'));
                $_POST['phone'] = '';
                $errors++;
            } else {
                $phone = $db->escape($_POST['phone']);
                $phone_count = intval($db->get_var("select count(*) from users where user_id != {$user->id} and user_level != 'disabled' and user_level != 'autodisabled' and user_phone='{$phone}'"));
                if ($phone_count > 0) {
                    array_push($messages, _('ya hay otro usuario con el mismo número, no se ha grabado'));
                    $_POST['phone'] = '';
                    $errors++;
                }
            }
        }
        $user->phone = $_POST['phone'];
        // End check phone number
    }
    // Verifies adsense code
    if ($globals['external_user_ads']) {
        $_POST['adcode'] = trim($_POST['adcode']);
        $_POST['adchannel'] = trim($_POST['adchannel']);
        if (!empty($_POST['adcode']) && $user->adcode != $_POST['adcode']) {
            if (!preg_match('/pub-[0-9]{16}$/', $_POST['adcode'])) {
                array_push($messages, _('código AdSense incorrecto, no se ha grabado'));
                $_POST['adcode'] = '';
                $errors++;
            } else {
//.........这里部分代码省略.........
开发者ID:GallardoAlba,项目名称:Meneame,代码行数:101,代码来源:profile.php

示例9: sprintf

									<input type="submit" name="create" value="Create"> <?php 
echo $message1;
?>
								</td>
							</tr>
						</table>
					</form>
	
				</div>

				<div style="border: 1px solid #bbb; margin: 10px; padding: 10px;">
					<h2 class="caption">Delete User</h2>

					<?php 
if ($delete == 'Delete') {
    if (check_username($existing_user)) {
        if ($noconfirm) {
            $query = sprintf("DELETE FROM user WHERE md5(username)=md5('%s')", $mysql->escape($existing_user));
            if ($mysql->query($query)) {
                $message2 = "User {$existing_user} deleted.<br>";
            } else {
                message($mysql->error);
            }
            $query = sprintf("DELETE FROM bookmark WHERE md5(user)=md5('%s')", $mysql->escape($existing_user));
            if (!$mysql->query($query)) {
                message($mysql->error);
            }
            $query = sprintf("DELETE FROM folder WHERE md5(user)=md5('%s')", $mysql->escape($existing_user));
            if (!$mysql->query($query)) {
                message($mysql->error);
            }
开发者ID:wsunxa,项目名称:openbookmark,代码行数:31,代码来源:admin.php

示例10: saveUsername

 /**
  * saveUsername  修改用户名
  * @author:xjw129xjt(肖骏涛) xjt@ourstu.com
  */
 public function saveUsername()
 {
     $aUsername = $cUsername = I('post.username', '', 'op_t');
     if (!check_reg_type('username')) {
         $this->error('用户名选项已关闭!');
     }
     //判断是否登录
     if (!is_login()) {
         $this->error('请登录后操作!');
     }
     //判断提交的用户名是否为空
     if (empty($aUsername)) {
         $this->error('用户名不能为空!');
     }
     check_username($cUsername, $cEmail, $cMobile);
     if (empty($cUsername)) {
         !empty($cEmail) && ($str = '邮箱');
         !empty($cMobile) && ($str = '手机');
         $this->error('用户名不能为' . $str);
     }
     //验证用户名是否是字母和数字
     preg_match("/^[a-zA-Z0-9_]{4,32}\$/", $aUsername, $match);
     if (!$match) {
         $this->error('用户名只允许英文字母和数字');
     }
     $uid = get_uid();
     $mUcenter = UCenterMember();
     //判断用户是否已设置用户名
     $username = $mUcenter->where(array('id' => $uid))->getField('username');
     if (empty($username)) {
         //判断修改的用户名是否已存在
         $id = $mUcenter->where(array('username' => $aUsername))->getField('id');
         if ($id) {
             $this->error('该用户名已经存在!');
         } else {
             //修改用户名
             $rs = $mUcenter->where(array('id' => $uid))->save(array('username' => $aUsername));
             if (!$rs) {
                 $this->error('设置失败!');
             }
             $this->success('设置成功!', 'refresh');
         }
     }
     $this->error('用户名已经确定不允许修改!');
 }
开发者ID:smartymoon,项目名称:e-anjia,代码行数:49,代码来源:ConfigController.class.php

示例11: forum_list_langs

     $languages = forum_list_langs();
     $form['language'] = pun_trim($_POST['form']['language']);
     if (!in_array($form['language'], $languages)) {
         message($lang_common['Bad request']);
     }
 }
 if ($pun_user['is_admmod']) {
     $form['admin_note'] = pun_trim($_POST['admin_note']);
     // Are we allowed to change usernames?
     if ($pun_user['g_id'] == PUN_ADMIN || $pun_user['g_moderator'] == '1' && $pun_user['g_mod_rename_users'] == '1') {
         $form['username'] = pun_trim($_POST['req_username']);
         if ($form['username'] != $old_username) {
             // Check username
             require PUN_ROOT . 'lang/' . $pun_user['language'] . '/register.php';
             $errors = array();
             check_username($form['username'], $id);
             if (!empty($errors)) {
                 message($errors[0]);
             }
             $username_updated = true;
         }
     }
     // We only allow administrators to update the post count
     if ($pun_user['g_id'] == PUN_ADMIN) {
         $form['num_posts'] = intval($_POST['num_posts']);
     }
 }
 if ($pun_config['o_regs_verify'] == '0' || $pun_user['is_admmod']) {
     require PUN_ROOT . 'include/email.php';
     // Validate the email address
     $form['email'] = strtolower(trim($_POST['req_email']));
开发者ID:highpictv,项目名称:forum,代码行数:31,代码来源:profile.php

示例12: checkProfile

 function checkProfile($request)
 {
     $userid = $_SESSION['user']['id'];
     $errors = FALSE;
     if (empty($request['user_email'])) {
         $errors .= 'The email address field cannot be empty.  Check Profile<br />';
     }
     if (empty($request['user_name'])) {
         $errors .= 'The username field cannot be empty.<br />';
     }
     if (!preg_match('/^[a-zA-Z0-9\\._%\\-]+@[a-zA-Z0-9.\\_%\\-]+\\.[a-zA-Z0-9]{2,6}$/i', $request['user_email'])) {
         $errors .= 'The email address is not properly formatted (i.e. <em>youremail@yourdomain.com</em>).<br />';
     }
     if (!preg_match('/^[[:space:]a-zA-Z0-9\'\\.*#\\/\\_;:\\-]{6,30}$/i', $request['user_name'])) {
         $errors .= 'The User Name must have a minimum of 6 characters, with a maximum of 30;  And cannot contain certain special characters.<br />';
     }
     if (isset($request['user_pass']) and !empty($request['user_pass'])) {
         if (empty($request['user_pass2'])) {
             $errors .= 'The confirm password field cannot be empty.<br />';
         }
         if (strlen($request['user_pass']) > 30 || strlen($request['user_pass']) < 6) {
             $errors .= 'The Password must have a minimum of 6 characters, with a maximum of 30.<br />';
         }
         if (strcasecmp($request['user_pass'], $request['user_pass2']) != 0) {
             $errors .= 'The Passwords submitted do not match.<br />';
         }
     }
     // check if user_name is in use.
     if ($request['user_name'] != $_SESSION['user']['username']) {
         if (check_username($request['user_name'])) {
             $errors .= 'The user name you have selected is already in use in our system.  Please chose another<br />';
         }
     }
     //check if email address is in use.
     if ($request['user_email'] != $_SESSION['user']['email']) {
         if (check_email($request['user_email'], $userid)) {
             $errors .= 'The email you have entered ( ' . $email . ' ) is already in use in our system.<br />';
         }
     }
     // PROFILE and SHIPPING INFORMATION
     if (empty($request['user_fname'])) {
         $errors .= 'The first name field cannot be empty.<br />';
     }
     if (empty($request['user_lname'])) {
         $errors .= 'The last name field cannot be empty.<br />';
     }
     if (empty($request['user_addr1'])) {
         $errors .= 'The address field cannot be empty.<br />';
     }
     if (empty($request['user_city'])) {
         $errors .= 'The city field cannot be empty.<br />';
     }
     if (empty($request['user_state']) or $request['user_state'] == '0') {
         $errors .= 'Please select your state.<br />';
     }
     if (empty($request['user_zc1'])) {
         $errors .= 'The zip code field cannot be empty.<br />';
     }
     if (empty($request['user_phone1']) or empty($request['user_phone2']) or empty($request['user_phone3'])) {
         $errors .= 'The main phone number field cannot be empty.<br />';
     }
     if (!preg_match('/^[0-9]{5,5}$/i', $request['user_zc1'])) {
         $errors .= 'The first zip code field is not properly formatted.  Must be 5 numbers only.<br />';
     }
     if (!empty($request['user_zc2']) and !preg_match('/^[0-9]{4,4}$/i', $request['user_zc2'])) {
         $errors .= 'The second zip code field is not properly formatted.  Must be 5 numbers only.<br />';
     }
     if (!preg_match('/^[0-9]{3,3}$/i', $request['user_phone1'])) {
         $errors .= 'The first main phone number field is not properly formatted.  Must be 3 numbers only.<br />';
     }
     if (!preg_match('/^[0-9]{3,3}$/i', $request['user_phone2'])) {
         $errors .= 'The second main phone number field is not properly formatted.  Must be 3 numbers only.<br />';
     }
     if (!preg_match('/^[0-9]{4,4}$/i', $request['user_phone3'])) {
         $errors .= 'The third main phone number field is not properly formatted.  Must be 4 numbers only.<br />';
     }
     if (!empty($request['user_phone4']) and !empty($request['user_phone5']) and !empty($request['user_phone6'])) {
         if (!preg_match('/^[0-9]{3,3}$/i', $request['user_phone4'])) {
             $errors .= 'The first alt phone number field is not properly formatted.  Must be 3 numbers only.<br />';
         }
         if (!preg_match('/^[0-9]{3,3}$/i', $request['user_phone5'])) {
             $errors .= 'The second alt phone number field is not properly formatted.  Must be 3 numbers only.<br />';
         }
         if (!preg_match('/^[0-9]{4,4}$/i', $request['user_phone6'])) {
             $errors .= 'The third alt phone number field is not properly formatted.  Must be 4 numbers only.<br />';
         }
     }
     // return
     return $errors;
 }
开发者ID:Jonathonbyrd,项目名称:5TwentyCMS,代码行数:90,代码来源:profile.php

示例13: meta_model

<div class="container box">
	<div class="row">
		<div class="col-xs-12">
<?php 
echo "<h2>" . $ini['app_title'] . "</h2>";
if (isset($_POST['user'])) {
    $username = $_POST['user'];
    $passwd = $_POST['pwd'];
    if ($use_metadata) {
        $meta_model = new meta_model();
        $meta_model->user = $username;
        $meta_model->email = $_POST['email'];
        $meta_model->name = $_POST['name'];
        $meta_model->mailkey = random_password(8);
    }
    if (!check_username($username) || !check_password_quality($passwd)) {
        ?>
			<div class="alert alert-danger">
			<?php 
        echo "<p>User <em>" . htmlspecialchars($username) . "</em> is invalid!.</p>";
    } else {
        ?>
			<div class="alert alert-info">
			<?php 
        if (!$htpasswd->user_exists($username)) {
            $htpasswd->user_add($username, $passwd);
            echo "<p>User <em>" . htmlspecialchars($username) . "</em> created.</p>";
        } else {
            $htpasswd->user_update($username, $passwd);
            echo "<p>User <em>" . htmlspecialchars($username) . "</em> changed.</p>";
        }
开发者ID:soster,项目名称:htadmin,代码行数:31,代码来源:index.php

示例14: folder

} else {
    ?>
			<li><a href="./index.php">Login</a></li>
			<?php 
}
?>
		</ul>
	<!-- Menu ends here. -->
	</div>

	<!-- Main content starts here. -->
	<div id="main">


<?php 
if (isset($_GET['user']) && check_username($user)) {
    ?>


	<!-- Folders starts here. -->
	<div class="folders" style="width: <?php 
    echo $column_width_folder;
    ?>
; height: <?php 
    echo $table_height;
    ?>
;">

	<?php 
    require_once ABSOLUTE_PATH . "folders.php";
    $tree = new folder($user);
开发者ID:roxine9,项目名称:online-bookmarks,代码行数:31,代码来源:shared.php

示例15: set_post_bool_var

<?php

require_once "./header.php";
$secret = "dDWUc72sCcs20cXskcw";
$reg_register = set_post_bool_var('reg_register', false);
$reg_username = set_post_string_var('reg_username');
$reg_email = set_post_string_var('reg_email');
$confirm = set_get_string_var('confirm');
if ($reg_register) {
    if ($reg_username != "") {
        if (check_username($reg_username)) {
            echo '<div style="color:red;">$username is an already registered user. Choose another one.</div>' . "\n";
            $username = false;
        } else {
            $username = $reg_username;
        }
    } else {
        echo '<div style="color:red;">Please enter a Username.</div>' . "\n";
        $username = false;
    }
    if (isset($_POST['reg_password1']) && $_POST['reg_password1'] != "" && isset($_POST['reg_password2']) && $_POST['reg_password2'] != "") {
        if (md5($_POST['reg_password1']) != md5($_POST['reg_password2'])) {
            echo '<div style="color:red;">Passwords do not match.</div>' . "\n";
            $password = false;
        } else {
            $password = md5($_POST['reg_password1']);
        }
    } else {
        echo '<div style="color:red;">Please fill out both password fields.</div>' . "\n";
        $password = false;
    }
开发者ID:wsunxa,项目名称:openbookmark,代码行数:31,代码来源:register.php


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