Redesigned register functions
This commit is contained in:
@@ -10,33 +10,90 @@
|
||||
<?php
|
||||
session_start();
|
||||
if(isset($_SESSION["userID"])){
|
||||
header("location: profile.php");
|
||||
header("location: login.php");
|
||||
}
|
||||
// define variables and set to empty values
|
||||
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = "";
|
||||
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = "";
|
||||
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = $captcha = $ip = "";
|
||||
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = $captchaErr = "";
|
||||
$correct = true;
|
||||
|
||||
// Trying to register an account
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
checkInputChoice("name", "lettersAndSpace");
|
||||
checkInputChoice("surname", "lettersAndSpace");
|
||||
|
||||
if (empty($_POST["bday"])) {
|
||||
$bdayErr = "Geboortedatum is verplicht!";
|
||||
try {
|
||||
$name = test_input(($_POST["name"]));
|
||||
checkInputChoice($name, "lettersAndSpaces");
|
||||
} catch(lettersAndSpacesException $e){
|
||||
$correct = false;
|
||||
|
||||
} else {
|
||||
$bday = test_input($_POST["bday"]);
|
||||
$nameErr = $e->getMessage();
|
||||
}
|
||||
|
||||
checkInputChoice("username", "username");
|
||||
checkInputChoice("password", "longerEight");
|
||||
checkInputChoice("confirmpassword", "");
|
||||
matchPassword();
|
||||
checkInputChoice("location", "lettersAndSpace");
|
||||
checkInputChoice("email", "email");
|
||||
registerCheck();
|
||||
try {
|
||||
$surname = test_input(($_POST["surname"]));
|
||||
checkInputChoice($surname, "lettersAndSpaces");
|
||||
}
|
||||
catch(lettersAndSpacesException $e){
|
||||
$correct = false;
|
||||
$surnameErr = $e->getMessage();
|
||||
}
|
||||
|
||||
try{
|
||||
$bday = test_input(($_POST["bday"]));
|
||||
checkInputChoice($bday, "bday");
|
||||
} catch(bdayException $e){
|
||||
$correct = false;
|
||||
$bdayErr = $e->getMessage();
|
||||
}
|
||||
|
||||
try{
|
||||
$username = test_input(($_POST["username"]));
|
||||
checkInputChoice($username, "username");
|
||||
} catch(usernameException $e){
|
||||
$correct = false;
|
||||
$usernameErr = $e->getMessage();
|
||||
}
|
||||
|
||||
try{
|
||||
$password = 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");
|
||||
} catch(emailException $e){
|
||||
$correct = false;
|
||||
$emailErr = $e->getMessage();
|
||||
}
|
||||
|
||||
try{
|
||||
$captcha = $_POST['g-recaptcha-response'];
|
||||
checkCaptcha($captcha);
|
||||
} catch(captchaException $e){
|
||||
$correct = false;
|
||||
$captchaErr = $e->getMessage();
|
||||
}
|
||||
|
||||
try {
|
||||
getIp();
|
||||
registerCheck($correct);
|
||||
} catch(registerException $e){
|
||||
$genericErr = $e->getMessage();
|
||||
}
|
||||
}
|
||||
/* This view adds register view */
|
||||
include("../views/register-view.php");
|
||||
|
||||
@@ -4,17 +4,16 @@ a.button {
|
||||
color: black;
|
||||
cursor: pointer;
|
||||
height: 50%;
|
||||
margin: 8px 0;
|
||||
padding: 14px 20px;
|
||||
width: 25%;
|
||||
padding: 8px 20px;
|
||||
width: 50%;
|
||||
font-family: Arial;
|
||||
font-size: 16px;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
/* Body */
|
||||
body {
|
||||
height: 100%;
|
||||
background-color: #C8CABD;
|
||||
background-color: #FBC02D;
|
||||
/*background-image: url(http://play.pokemonshowdown.com/fx/client-bg-shaymin.jpg);
|
||||
background-size: cover;
|
||||
background-attachment: fixed;*/
|
||||
@@ -24,31 +23,14 @@ body {
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
/* The Close Button */
|
||||
.close {
|
||||
/* Position it in the top right corner outside of the modal */
|
||||
color: white;
|
||||
font-size: 100px;
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
right: 25px;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
/* Close button on hover */
|
||||
.close:hover,
|
||||
.close:focus {
|
||||
color: red;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* inlogform */
|
||||
form {
|
||||
/*background-color: #a87a87;*/
|
||||
border-radius: 12px;
|
||||
height: 70%;
|
||||
height: 75%;
|
||||
margin: auto;
|
||||
width: 70%;
|
||||
width: 80%;
|
||||
overflow-y:auto;
|
||||
}
|
||||
|
||||
@@ -72,24 +54,20 @@ input[type=text], input[type=password], input[type=email], input[type="date"] {
|
||||
border-color: #C8CABD;
|
||||
display: inline-block;
|
||||
height: 60%;
|
||||
font-size: 16px;
|
||||
padding: 8px 20px;
|
||||
margin: 4px 0;
|
||||
width: 70%;
|
||||
width: 55%;
|
||||
}
|
||||
/*
|
||||
input[type=text], input[type=password], input[type=email], input[type="date"] {
|
||||
border: 0px;
|
||||
border-bottom: 4px solid lightgray;
|
||||
border-radius: 0px;
|
||||
}*/
|
||||
|
||||
button[type=submit] {
|
||||
background-color: #C8CABD;
|
||||
color: black ;
|
||||
color: black;
|
||||
cursor: pointer;
|
||||
font-family: Arial;
|
||||
font-size: 16px;
|
||||
width: 50%;
|
||||
font-size: 22px;
|
||||
height: 30px;
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.error {
|
||||
@@ -106,12 +84,12 @@ label {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
background-color: #C8CABD;
|
||||
height: 30px;
|
||||
width: 90px;
|
||||
padding: 3px 3px 3px 0px;
|
||||
height: 25px;
|
||||
width: 120px;
|
||||
padding: 3px 3px 3px 3px;
|
||||
text-align: center;
|
||||
border-radius: 0px 10px 10px 0px;
|
||||
font-size: 24px;
|
||||
border-radius: 0px 5px 5px 0px;
|
||||
font-size: 22px;
|
||||
|
||||
}
|
||||
.left-arrow:after {
|
||||
@@ -121,9 +99,9 @@ label {
|
||||
right: 100%;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
border-top: 15px solid transparent;
|
||||
border-top: 12px solid transparent;
|
||||
border-right: 20px solid #C8CABD;
|
||||
border-bottom: 15px solid transparent;
|
||||
border-bottom: 12px solid transparent;
|
||||
border-left: 0px solid transparent;
|
||||
}
|
||||
|
||||
@@ -135,7 +113,7 @@ label {
|
||||
|
||||
/* padding voor login_containers */
|
||||
.login_containerlogin {
|
||||
padding:25px;
|
||||
padding:16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@@ -163,7 +141,7 @@ label {
|
||||
margin: 34px auto;
|
||||
overflow-y: auto;
|
||||
padding: 20px;
|
||||
width: 50%;
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
/*.platform {
|
||||
|
||||
Reference in New Issue
Block a user