diff --git a/website/public/login.php b/website/public/login.php index d4dd991..81fee57 100644 --- a/website/public/login.php +++ b/website/public/login.php @@ -19,6 +19,14 @@ "; } + // define variables and set to empty values + $name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = $confirmEmail = $captcha = $ip = ""; + $genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = $confirmEmailErr = $captchaErr = ""; + $correct = true; + $day_date = "dag"; + $month_date = "maand"; + $year_date = "jaar"; + // Define variables and set to empty values $user = $psw =""; $loginErr = $resetErr =""; @@ -46,7 +54,96 @@ "; } 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 ""; + $genericErr = $e->getMessage(); + } } } // // Trying to login diff --git a/website/public/styles/index.css b/website/public/styles/index.css index 9829688..85cc670 100644 --- a/website/public/styles/index.css +++ b/website/public/styles/index.css @@ -28,10 +28,12 @@ body { form { /*background-color: #a87a87;*/ border-radius: 12px; - height: 85%; + height: 80%; margin: auto; - width: 80%; + width: 600px; overflow-y:auto; + overflow-x: hidden; + } @@ -130,7 +132,7 @@ label { margin: 34px auto; overflow-y: auto; padding: 20px; - width: 45%; + width: 600px; } select{ @@ -164,7 +166,7 @@ ul { margin: auto; padding: 0; border: 1px solid #888; - width: 500px; + width: 589px; box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19); -webkit-animation-name: animatetop; -webkit-animation-duration: 0.4s; @@ -204,7 +206,9 @@ ul { color: black; } -.modal-body {padding: 2px 16px;} +.modal-body { + padding: 2px 16px; +} .modal-footer { background-color: #FBC02D; diff --git a/website/queries/login.php b/website/queries/login.php index 15a5de1..6af9e1e 100644 --- a/website/queries/login.php +++ b/website/queries/login.php @@ -13,6 +13,7 @@ function getUser() { `email` LIKE :username "); + $stmt->bindParam(":username", test_input($_POST["user"])); $stmt->execute(); return $stmt->fetch(PDO::FETCH_ASSOC); } diff --git a/website/views/login-view.php b/website/views/login-view.php index c64590e..b9052b3 100644 --- a/website/views/login-view.php +++ b/website/views/login-view.php @@ -18,7 +18,7 @@ placeholder="Voer uw gebruikersnaam/email in" name="user" value="" - title="Moet 6 of meer karakters bevatten" + title="Moet een geldige gebruiker zijn" > @@ -86,32 +86,232 @@ + + + + + +