private function sign_up() { global $rep, $views, $errors; $errors = array(); //use to display the error message if needed on the sign up form if (isset($_POST['sign_up'])) { // If we clicked on the sign_up button //get all the inputs values $username = isset($_POST['username']) ? $_POST['username'] : ''; $pwd1 = isset($_POST['password']) ? $_POST['password'] : ''; $pwd2 = isset($_POST['confirmPass']) ? $_POST['confirmPass'] : ''; $role = isset($_POST['role']) ? $_POST['role'] : ''; $email = isset($_POST['email']) ? $_POST['email'] : ''; $country = isset($_POST['country']) ? $_POST['country'] : ''; if ($pwd1 != $pwd2) { //check the passwords $errors[] = "the two passwords must be similar"; $this->display_sign_up(); } else { if (!filter_var($email, FILTER_VALIDATE_EMAIL) || $email == "") { $errors[] = "invalid email"; $this->display_sign_up(); } else { if (Validation::val_password($pwd2, $errors) || Validation::val_username($username)) { //variable verifications Model_user::sign_up($username, $pwd2, $role, $email, $country); $cont = new Controller_visitor("home"); // if variables are not correct } } } } }