Made different files for login and register #142

Merged
11057122 merged 1 commits from joey-testing into master 2017-01-27 14:04:40 +01:00
10 changed files with 127 additions and 113 deletions

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,4 +1,5 @@
<?php <?php
try { try {
$name = test_input(($_POST["name"])); $name = test_input(($_POST["name"]));
checkInputChoice($name, "lettersAndSpaces"); checkInputChoice($name, "lettersAndSpaces");

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>