예제 #1
0
     throw new EmptyDataException("wrong_email_pattern");
 }
 if ($validator->validateName($firstname) == false || $validator->validateName($lastname) == false) {
     throw new EmptyDataException("wrong_name_pattern");
 }
 if ($validator->validatePassword($password) == false) {
     throw new EmptyDataException("wrong_password_pattern");
 }
 if ($validator->validateUsername($username) == false) {
     throw new EmptyDataException("wrong_username_pattern");
 }
 if ($userdata->getUsername() != $username) {
     /**
      * Look if user with entered username already exists
      */
     if (!empty($userBiz->checkUserByUsername($username))) {
         throw new UserExistsException("username_exists");
     }
 }
 if ($userdata->getEmail() != $email) {
     /**
      * Look if user with entered e-mail already exists
      */
     if (!empty($userBiz->checkUserByEmail($email))) {
         throw new UserExistsException("email_exists");
     }
 }
 /**
  * Upload image
  */
 if (isset($_FILES['user_image']) && !empty($_FILES['user_image']['name'])) {
예제 #2
0
 if ($validator->validateEmail($_SESSION['savedData']['email']) == false) {
     throw new EmptyDataException("wrong_email_pattern");
 }
 if ($validator->validateName($_SESSION['savedData']['firstname']) == false || $validator->validateName($_SESSION['savedData']['lastname']) == false) {
     throw new EmptyDataException("wrong_name_pattern");
 }
 if ($validator->validatePassword($_SESSION['savedData']['password']) == false) {
     throw new EmptyDataException("wrong_password_pattern");
 }
 if ($validator->validateUsername($_SESSION['savedData']['username']) == false) {
     throw new EmptyDataException("wrong_username_pattern");
 }
 /**
  * Look if user with entered username already exists
  */
 if (!empty($userBiz->checkUserByUsername($_SESSION['savedData']['username']))) {
     throw new UserExistsException("username_exists");
 }
 /**
  * Look if user with entered e-mail already exists
  */
 if (!empty($userBiz->checkUserByEmail($_SESSION['savedData']['email']))) {
     throw new UserExistsException("email_exists");
 }
 $userImage = "default.jpg";
 if (isset($_FILES['userImage']) && !empty($_FILES['userImage']['name'])) {
     $file = $_FILES['userImage'];
     /**
      * File properties
      */
     $file_name = $file['name'];