Made different files for login and register

This commit is contained in:
Joey Lai
2017-01-27 12:27:40 +01:00
parent 23904caf69
commit 609f350cd3
10 changed files with 482 additions and 479 deletions

View File

@@ -28,7 +28,7 @@
$year_date = "jaar";
// Define variables and set to empty values
$user = $psw ="";
$user = $psw = $remember ="";
$loginErr = $resetErr ="";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
@@ -55,107 +55,9 @@
}
break;
case "register":
try {
$name = test_input(($_POST["name"]));
checkInputChoice($name, "lettersAndSpaces");
} catch(lettersAndSpacesException $e){
$correct = false;
$nameErr = $e->getMessage();
}
try {
$surname = test_input(($_POST["surname"]));
checkInputChoice($surname, "lettersAndSpaces");
}
catch(lettersAndSpacesException $e){
$correct = false;
$surnameErr = $e->getMessage();
}
try{
$day_date = test_input(($_POST["day_date"]));
$month_date = test_input(($_POST["month_date"]));
$year_date = test_input(($_POST["year_date"]));
$bday = $year_date . "-" . $month_date . "-" . $day_date;
checkInputChoice($bday, "bday");
} catch(bdayException $e){
$correct = false;
$bdayErr = $e->getMessage();
}
try{
$username = str_replace(' ', '', test_input(($_POST["username"])));
checkInputChoice($username, "username");
} catch(usernameException $e){
$correct = false;
$usernameErr = $e->getMessage();
}
try{
$password = str_replace(' ', '', test_input(($_POST["password"])));
checkInputChoice($password, "longerEight");
matchPassword();
} catch(passwordException $e){
$correct = false;
$passwordErr = $e->getMessage();
} catch(confirmPasswordException $e){
$correct = false;
$confirmPasswordErr = $e->getMessage();
}
try{
$location = test_input(($_POST["location"]));
checkInputChoice($location, "lettersAndSpaces");
} catch(lettersAndSpacesException $e){
$correct = false;
$locationErr = $e->getMessage();
}
try{
$email = test_input(($_POST["email"]));
checkInputChoice($email, "email");
$confirmEmail = test_input(($_POST["confirmEmail"]));
matchEmail();
} catch(emailException $e){
$correct = false;
$emailErr = $e->getMessage();
} catch(confirmEmailException $e){
$correct = false;
$confirmEmailErr = $e->getMessage();
}
try{
$captcha = $_POST['g-recaptcha-response'];
checkCaptcha($captcha);
} catch(captchaException $e){
$correct = false;
$captchaErr = $e->getMessage();
}
try {
getIp();
registerCheck($correct);
sendConfirmEmailUsername($username);
} catch(registerException $e){
echo "<script>
window.onload = function() {
$('#registerModal').show();
}
</script>";
$genericErr = $e->getMessage();
}
include("register.php");
}
}
// // Trying to login
// if ($_SERVER["REQUEST_METHOD"] == "POST") {
// try{
// $uname = ($_POST["uname"]);
// validateLogin($_POST["uname"], $_POST["psw"]);
// } catch(loginException $e) {
// $loginErr = $e->getMessage();
// }
// }
/* This view adds login view */
include("../views/login-view.php");
?>