コード例 #1
0
/**  
 * @see  verifyAll() Verification of First Name
 * @return boolean TRUE == OK, FALSE == empty
 */
function verifyAll()
{
    if (verifyCaptcha() && verifyUsername() && verifyEmail() && verifyFisrtName() && verifyLastName() && verifyPassword1() && verifyPassword2() && verifyTelephoneNumber()) {
        if (verifyCorrespond()) {
            //echo ' Passwords OK <br />';
            //echo '<br />Communication with the database<br />';
            include "PhpmyadminCommunication.php";
        }
        //echo 'Any field are filled <br />';
    }
}
コード例 #2
0
 public function newUser()
 {
     $username = I('username');
     //昵称
     $password = I('password');
     //密码
     $confirmPassword = I('confirmPassword');
     //确认密码
     //判断用户昵称格式
     if (!verifyUsername($username)) {
         $this->ajaxReturn(0, "用户昵称格式错误(4-30个字符,中英文、数字、下划线)", -1);
     }
     //判断密码长度
     if (strlen($password) < 6 || strlen($password) > 20) {
         $this->ajaxReturn(0, "密码必须保持在6到20个字符之间", -2);
     }
     //判断确认密码
     if ($password != $confirmPassword) {
         $this->ajaxReturn(0, "两次密码输入不一致", -3);
     }
     //判断用户昵称是否重复
     if (M('user')->where(array('username' => $username))->count('id') > 0) {
         $this->ajaxReturn(0, "该用户昵称已存在", -4);
     }
     //判断手机号码是否重复
     if (M('user')->where(array('mobile' => session('regMobile')))->count('id') > 0) {
         $this->ajaxReturn(0, "该手机号码已被注册", -5);
     }
     $data = array('mobile' => session('regMobile'), 'username' => $username, 'password' => md5($password));
     if ($id = M('user')->add($data)) {
         M('userinfo')->add(array('uid' => $id, 'time' => time()));
         session('uid', $id);
         $this->ajaxReturn(array('uid' => $id), "注册成功", 1);
     } else {
         $this->ajaxReturn(0, "系统错误", -101);
     }
 }
コード例 #3
0
ファイル: login.php プロジェクト: apdisant/modnod
 $HashedPass = md5($Password);
 if ($debug) {
     print '<p> pass: '******'</p> <p> hashed: ' . $HashedPass . '</p>';
 }
 include "validation_functions.php";
 $errorMsg = array();
 //############################################################################
 //
 // Check each of the fields for errors then adding any mistakes to the array.
 //
 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^       Check email address
 if (empty($Username)) {
     $errorMsg[] = "Please enter your Username";
     $UsernameERROR = true;
 } else {
     $valid = verifyUsername($Username);
     /* test for non-valid  data */
     if (!$valid) {
         $errorMsg[] = "I'm sorry, the username you entered is not valid.";
         $UsernameERROR = true;
     }
 }
 if (empty($Password)) {
     $errorMsg[] = "Please enter your Password";
     $PasswordERROR = true;
 } else {
     $valid = verifyPass($Password);
     /* test for non-valid  data */
     if (!$valid) {
         $errorMsg[] = "I'm sorry, the username you entered is not valid.";
         $PasswordERROR = true;