Hendrik testing #149

Merged
11342374 merged 27 commits from hendrik-testing into master 2017-01-27 16:16:10 +01:00
10 changed files with 127 additions and 113 deletions
Showing only changes of commit 5e9629eddd - Show all commits

View File

@@ -1,5 +1,5 @@
function checkLoggedIn() { function checkLoggedIn() {
if (confirm("You are already logged in!\nDo you want to logout?\nPress ok to logout.") == true) { if (confirm("U bent al ingelogd!!\nWilt u uitloggen?\nKlik ok om uit te loggen.") == true) {
window.location.href = "logout.php"; window.location.href = "logout.php";
} else { } else {
window.location.href = "profile.php"; window.location.href = "profile.php";
@@ -7,9 +7,9 @@ function checkLoggedIn() {
} }
function bannedAlert(){ function bannedAlert(){
alert("Your account is banned"); alert("Uw account is geband!");
} }
function emailNotConfirmed(){ function emailNotConfirmed(){
alert("Your account has not been verified yet!\nAnother email has been sent to you") alert("Uw account is nog niet bevestigd!\nEr is een nieuwe email gestuurd om uw account te bevestigen");
} }

View File

@@ -1,90 +1,91 @@
<?php <?php
try {
$name = test_input(($_POST["name"]));
checkInputChoice($name, "lettersAndSpaces");
} catch(lettersAndSpacesException $e){
$correct = false;
$nameErr = $e->getMessage();
}
try { try {
$surname = test_input(($_POST["surname"])); $name = test_input(($_POST["name"]));
checkInputChoice($surname, "lettersAndSpaces"); checkInputChoice($name, "lettersAndSpaces");
} } catch(lettersAndSpacesException $e){
catch(lettersAndSpacesException $e){ $correct = false;
$correct = false; $nameErr = $e->getMessage();
$surnameErr = $e->getMessage(); }
}
try{ try {
$day_date = test_input(($_POST["day_date"])); $surname = test_input(($_POST["surname"]));
$month_date = test_input(($_POST["month_date"])); checkInputChoice($surname, "lettersAndSpaces");
$year_date = test_input(($_POST["year_date"])); }
$bday = $year_date . "-" . $month_date . "-" . $day_date; catch(lettersAndSpacesException $e){
checkInputChoice($bday, "bday"); $correct = false;
} catch(bdayException $e){ $surnameErr = $e->getMessage();
$correct = false; }
$bdayErr = $e->getMessage();
}
try{ try{
$username = str_replace(' ', '', test_input(($_POST["username"]))); $day_date = test_input(($_POST["day_date"]));
checkInputChoice($username, "username"); $month_date = test_input(($_POST["month_date"]));
} catch(usernameException $e){ $year_date = test_input(($_POST["year_date"]));
$correct = false; $bday = $year_date . "-" . $month_date . "-" . $day_date;
$usernameErr = $e->getMessage(); checkInputChoice($bday, "bday");
} } catch(bdayException $e){
$correct = false;
$bdayErr = $e->getMessage();
}
try{ try{
$password = str_replace(' ', '', test_input(($_POST["password"]))); $username = str_replace(' ', '', test_input(($_POST["username"])));
checkInputChoice($password, "longerEight"); checkInputChoice($username, "username");
matchPassword(); } catch(usernameException $e){
} catch(passwordException $e){ $correct = false;
$correct = false; $usernameErr = $e->getMessage();
$passwordErr = $e->getMessage(); }
} catch(confirmPasswordException $e){
$correct = false;
$confirmPasswordErr = $e->getMessage();
}
try{ try{
$location = test_input(($_POST["location"])); $password = str_replace(' ', '', test_input(($_POST["password"])));
checkInputChoice($location, "lettersAndSpaces"); checkInputChoice($password, "longerEight");
} catch(lettersAndSpacesException $e){ matchPassword();
$correct = false; } catch(passwordException $e){
$locationErr = $e->getMessage(); $correct = false;
} $passwordErr = $e->getMessage();
} catch(confirmPasswordException $e){
$correct = false;
$confirmPasswordErr = $e->getMessage();
}
try{ try{
$email = test_input(($_POST["email"])); $location = test_input(($_POST["location"]));
checkInputChoice($email, "email"); checkInputChoice($location, "lettersAndSpaces");
$confirmEmail = test_input(($_POST["confirmEmail"])); } catch(lettersAndSpacesException $e){
matchEmail(); $correct = false;
} catch(emailException $e){ $locationErr = $e->getMessage();
$correct = false; }
$emailErr = $e->getMessage();
} catch(confirmEmailException $e){
$correct = false;
$confirmEmailErr = $e->getMessage();
}
try{ try{
$captcha = $_POST['g-recaptcha-response']; $email = test_input(($_POST["email"]));
checkCaptcha($captcha); checkInputChoice($email, "email");
} catch(captchaException $e){ $confirmEmail = test_input(($_POST["confirmEmail"]));
$correct = false; matchEmail();
$captchaErr = $e->getMessage(); } catch(emailException $e){
} $correct = false;
$emailErr = $e->getMessage();
} catch(confirmEmailException $e){
$correct = false;
$confirmEmailErr = $e->getMessage();
}
try { try{
getIp(); $captcha = $_POST['g-recaptcha-response'];
registerCheck($correct); checkCaptcha($captcha);
sendConfirmEmailUsername($username); } catch(captchaException $e){
} catch(registerException $e){ $correct = false;
echo "<script> $captchaErr = $e->getMessage();
}
try {
getIp();
registerCheck($correct);
sendConfirmEmailUsername($username);
} catch(registerException $e){
echo "<script>
window.onload = function() { window.onload = function() {
$('#registerModal').show(); $('#registerModal').show();
} }
</script>"; </script>";
$genericErr = $e->getMessage(); $genericErr = $e->getMessage();
} }

View File

@@ -68,6 +68,10 @@ input[type=text], input[type=password], input[type=email], input[type="date"] {
width: 55%; width: 55%;
} }
.middle{
text-align: center;
}
.center{ .center{
text-align: center; text-align: center;
} }

View File

@@ -124,11 +124,11 @@ function matchPassword(){
/* Checks if captcha is correctly filled in */ /* Checks if captcha is correctly filled in */
function checkCaptcha($captcha){ function checkCaptcha($captcha){
if(!$captcha){ if(!$captcha){
throw new captchaException("Captcha needs to be filled in!"); throw new captchaException("Captcha moet ingevuld worde!");
} else { } else {
$response=json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6Lc72xIUAAAAAPizuF3nUbklCPljVCVzgYespz8o&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR'])); $response=json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6Lc72xIUAAAAAPizuF3nUbklCPljVCVzgYespz8o&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']));
if($response->success==false) { if($response->success==false) {
throw new captchaException("You are a spammer!"); throw new captchaException("Je bent een spammer!");
} }
} }
} }

View File

@@ -42,9 +42,9 @@ function validateLogin($username, $password){
</script>"; </script>";
} else { } else {
$_SESSION["userID"] = $userID; $_SESSION["userID"] = $userID;
if($_POST[rememberMe] == 1){ // if($_POST[rememberMe] == 1){
ini_set("session.gc_maxlifetime", "10"); // ini_set("session.gc_maxlifetime", "10");
} // }
header("location: profile.php"); header("location: profile.php");
} }
} else { } else {

View File

@@ -10,7 +10,7 @@ function getExistingUsername() {
`username` LIKE :username `username` LIKE :username
"); ");
$stmt->bindParam(":username", test_input($_POST["username"])); $stmt->bindValue(":username", test_input($_POST["username"]));
$stmt->execute(); $stmt->execute();
return $stmt->rowCount(); return $stmt->rowCount();
@@ -26,7 +26,7 @@ function getExistingEmail() {
`email` LIKE :email `email` LIKE :email
"); ");
$stmt->bindParam(":email", test_input($_POST["email"])); $stmt->bindValue(":email", test_input($_POST["email"]));
$stmt->execute(); $stmt->execute();
return $stmt->rowCount(); return $stmt->rowCount();
@@ -42,7 +42,7 @@ function getResetEmail() {
`email` LIKE :email `email` LIKE :email
"); ");
$stmt->bindParam(":email", test_input($_POST["forgotEmail"])); $stmt->bindValue(":email", test_input($_POST["forgotEmail"]));
$stmt->execute(); $stmt->execute();
return $stmt->rowCount(); return $stmt->rowCount();
@@ -70,13 +70,13 @@ function registerAccount() {
$hash=password_hash($_POST["password"], PASSWORD_DEFAULT); $hash=password_hash($_POST["password"], PASSWORD_DEFAULT);
$stmt->bindParam(":fname", test_input($_POST["name"])); $stmt->bindValue(":fname", test_input($_POST["name"]));
$stmt->bindParam(":lname", test_input($_POST["surname"])); $stmt->bindValue(":lname", test_input($_POST["surname"]));
$stmt->bindParam(":bday", test_input($_POST["bday"])); $stmt->bindValue(":bday", test_input($_POST["bday"]));
$stmt->bindParam(":username", test_input($_POST["username"])); $stmt->bindValue(":username", test_input($_POST["username"]));
$stmt->bindParam(":password", test_input($hash)); $stmt->bindValue(":password", test_input($hash));
$stmt->bindParam(":location", test_input($_POST["location"])); $stmt->bindValue(":location", test_input($_POST["location"]));
$stmt->bindParam(":email", test_input(strtolower($_POST["email"]))); $stmt->bindValue(":email", test_input(strtolower($_POST["email"])));
$stmt->execute(); $stmt->execute();
$stmt->rowCount(); $stmt->rowCount();

View File

@@ -11,18 +11,18 @@
</select> </select>
<select name="month_date"> <select name="month_date">
<option>Maand</option> <option>Maand</option>
<option value="01" <?php submitselect($month_date, "01")?>>Januari</option> <option value="01" <?php submitselect($month_date, "01")?>>januari</option>
<option value="02" <?php submitselect($month_date, "02")?>>Februari</option> <option value="02" <?php submitselect($month_date, "02")?>>februari</option>
<option value="03" <?php submitselect($month_date, "03")?>>Maart</option> <option value="03" <?php submitselect($month_date, "03")?>>maart</option>
<option value="04" <?php submitselect($month_date, "04")?>>April</option> <option value="04" <?php submitselect($month_date, "04")?>>april</option>
<option value="05" <?php submitselect($month_date, "05")?>>Mei</option> <option value="05" <?php submitselect($month_date, "05")?>>mei</option>
<option value="06" <?php submitselect($month_date, "06")?>>Juni</option> <option value="06" <?php submitselect($month_date, "06")?>>juni</option>
<option value="07" <?php submitselect($month_date, "07")?>>Juli</option> <option value="07" <?php submitselect($month_date, "07")?>>juli</option>
<option value="08" <?php submitselect($month_date, "08")?>>Augustus</option> <option value="08" <?php submitselect($month_date, "08")?>>augustus</option>
<option value="09" <?php submitselect($month_date, "09")?>>September</option> <option value="09" <?php submitselect($month_date, "09")?>>september</option>
<option value="10" <?php submitselect($month_date, "10")?>>Oktober</option> <option value="10" <?php submitselect($month_date, "10")?>>oktober</option>
<option value="11" <?php submitselect($month_date, "11")?>>November</option> <option value="11" <?php submitselect($month_date, "11")?>>november</option>
<option value="12" <?php submitselect($month_date, "12")?>>December</option> <option value="12" <?php submitselect($month_date, "12")?>>december</option>
</select> </select>
<select name="year_date"> <select name="year_date">
<option>Jaar</option> <option>Jaar</option>

View File

@@ -16,6 +16,7 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<input type="text" <input type="text"
class="middle"
placeholder="Voer uw email in" placeholder="Voer uw email in"
name="forgotEmail" name="forgotEmail"
title="Voer een email in"> title="Voer een email in">

View File

@@ -15,6 +15,7 @@
<div class="login_containerlogin"> <div class="login_containerlogin">
<label><b>Gebruikersnaam/Email</b></label> <label><b>Gebruikersnaam/Email</b></label>
<input type="text" <input type="text"
class="middle"
placeholder="Voer uw gebruikersnaam/email in" placeholder="Voer uw gebruikersnaam/email in"
name="user" name="user"
value="<?php echo $user ?>" value="<?php echo $user ?>"
@@ -26,17 +27,13 @@
<div class="login_containerlogin"> <div class="login_containerlogin">
<label><b>Wachtwoord</b></label> <label><b>Wachtwoord</b></label>
<input type="password" <input type="password"
class="middle"
placeholder="Voer uw wachtwoord in" placeholder="Voer uw wachtwoord in"
name="psw" name="psw"
title="Moet minstens 8 karakters lang zijn" title="Moet minstens 8 karakters lang zijn"
> >
</div> </div>
<div class="login_containerlogin">
<label><b>Onthoud mij</b></label>
<input type="checkbox" name="rememberMe" value=1><br>
</div>
<!-- Error message --> <!-- Error message -->
<div class="login_containerfault"><span><?php echo $loginErr; ?></span></div> <div class="login_containerfault"><span><?php echo $loginErr; ?></span></div>
@@ -49,6 +46,11 @@
Inloggen Inloggen
</button> </button>
</div> </div>
<div class="login_containerlogin">
<label><b>Onthoud mij</b></label>
<input type="checkbox" name="rememberMe" value=1><br>
</div>
</form> </form>
</div> </div>
@@ -78,7 +80,10 @@ var registerSpan = document.getElementsByClassName("close")[1];
// When the user clicks the button, open the modal // When the user clicks the button, open the modal
btn.onclick = function () { btn.onclick = function () {
// modal.style.display = "block";
modal.style.display = "block"; modal.style.display = "block";
window.onload=emailSent();
} }
registerBtn.onclick = function () { registerBtn.onclick = function () {

View File

@@ -19,6 +19,8 @@
return= $correct return= $correct
method="post"> method="post">
<div class="login_containerregister"><label>U krijgt een bevestigingsemail na het registreren</label></div>
<!-- Error message --> <!-- Error message -->
<div class="login_containerfault"><?php echo $genericErr;?></span></div> <div class="login_containerfault"><?php echo $genericErr;?></span></div>
@@ -135,7 +137,8 @@
</div> </div>
<div class="login_containerregister"> <div class="login_containerregister">
<div class="g-recaptcha" data-sitekey="6Lc72xIUAAAAADumlWetgENm7NGd9Npyo0c_tYYQ"></div> <div class="g-recaptcha" data-sitekey="6Lc72xIUAAAAADumlWetgENm7NGd9Npyo0c_tYYQ">
</div>
<span class="error"> <?php echo $captchaErr;?></span> <span class="error"> <?php echo $captchaErr;?></span>
</div> </div>