Facebook login implemented

This commit is contained in:
Joey Lai
2017-01-31 16:12:22 +01:00
parent 08f668859c
commit 8e98001217
82 changed files with 11126 additions and 133 deletions

View File

@@ -1,5 +1,6 @@
<select name="day_date" >
<option>dag</option>
<!--All the days-->
<select name="day_date" autocomplete="bday-day">
<option>Dag</option>
<?php
for($i=1; $i<32; $i++) {
$i = sprintf("%02d", $i);
@@ -9,7 +10,8 @@
}
?>
</select>
<select name="month_date">
<!--All the months-->
<select name="month_date" autocomplete="bday-month">
<option>Maand</option>
<option value="01" <?php submitselect($month_date, "01")?>>januari</option>
<option value="02" <?php submitselect($month_date, "02")?>>februari</option>
@@ -24,11 +26,12 @@
<option value="11" <?php submitselect($month_date, "11")?>>november</option>
<option value="12" <?php submitselect($month_date, "12")?>>december</option>
</select>
<select name="year_date">
<!--All the year from 1900 till current year-->
<select name="year_date" autocomplete="bday-year">
<option>Jaar</option>
<?php
$year = (new DateTime)->format("Y");
for($i=$year; $i > $year - 100; $i--) {
for($i=$year; $i >= 1900; $i--) {
?>
<option value="<?= $i ?>" <?php submitselect($year_date, $i)?>><?= $i ?></option>
<?php

View File

@@ -0,0 +1,99 @@
<!-- The Modal -->
<div id="fbModal" class="modal">
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
return= $correct
method="post"
name="fbModal">
<!-- Modal content -->
<div class="modal-content">
<div class="modal-header">
<span class="close">&times;</span>
<h3>Voer uw gegevens in</h3>
</div>
<div class="modal-body">
<div class="login_containerfault"><span><?php echo $fbRegisterErr; ?></span></div>
<div class="login_containerfault"><span><?php echo $fbEmailErr; ?></span></div>
<!-- Register username -->
<div class="login_containerregister">
<label><b>Gebruikersnaam</b></label>
<input type="text"
placeholder="Voer uw gebruikersnaam in"
name="fbUsername"
value="<?php echo $fbUsername ?>"
title="Moet minimaal 6 karakters bevatten"
>
*<span class="error"> <?php echo $fbUsernameErr;?></span>
<ul>
<li>Minstens 6 karakters</li>
</ul>
</div>
<!-- Register password -->
<div class="login_containerregister">
<label><b>Wachtwoord</b></label>
<input type="password"
placeholder="Voer uw wachtwoord in"
name="fbPassword"
value="<?php echo $fbPassword ?>"
id="password"
>
*<span class="error"> <?php echo $fbPasswordErr;?></span>
<ul>
<li>Minstens 8 karakters</li>
</ul>
</div>
<!-- Repeat password -->
<div class="login_containerregister">
<label><b>Herhaal wachtwoord</b></label>
<input type="password"
placeholder="Herhaal wachtwoord"
name="fbConfirmpassword"
value="<?php echo $fbConfirmpassword ?>"
id="confirmpassword"
title="Herhaal wachtwoord"
>
*<span class="error"> <?php echo $fbConfirmpasswordErr;?></span>
</div>
<?php if(empty($userBday)) { ?>
<!-- Register birthday -->
<div class="login_containerregister">
<label><b>Geboortedatum</b></label>
<?php
include("../views/fbBdayInput.php");
?>
*<span class="error"> <?php echo $fbBdayErr;?></span>
</div>
<?php } ?>
</div>
<div class="modal-footer">
<button type="submit"
value="fbRegister"
name="submit"
id="frm1_submit">
Registreer account
</button>
</div>
</div>
<input type="hidden"
name="fbName"
value="<?php echo $fbName ?>">
<?php echo $fbName ?>
<input type="hidden"
name="fbSurname"
value="<?php echo $fbSurname ?>">
<?php echo $fbSurname ?>
<input type="hidden"
name="fbBday"
value="<?php echo $fbBday ?>">
<?php echo $fbBday ?>
<input type="hidden"
name="fbEmail"
value="<?php echo $fbEmail ?>">
<?php echo $fbEmail ?>
</form>
</div>

View File

@@ -0,0 +1,40 @@
<!--All the days-->
<select name="fbDay_date" autocomplete="bday-day">
<option>Dag</option>
<?php
for($i=1; $i<32; $i++) {
$i = sprintf("%02d", $i);
?>
<option value="<?= $i ?>" <?php submitselect($fbDay_date, $i)?>><?= $i ?></option>
<?php
}
?>
</select>
<!--All the months-->
<select name="fbMonth_date" autocomplete="bday-month">
<option>Maand</option>
<option value="01" <?php submitselect($fbMonth_date, "01")?>>januari</option>
<option value="02" <?php submitselect($fbMonth_date, "02")?>>februari</option>
<option value="03" <?php submitselect($fbMonth_date, "03")?>>maart</option>
<option value="04" <?php submitselect($fbMonth_date, "04")?>>april</option>
<option value="05" <?php submitselect($fbMonth_date, "05")?>>mei</option>
<option value="06" <?php submitselect($fbMonth_date, "06")?>>juni</option>
<option value="07" <?php submitselect($fbMonth_date, "07")?>>juli</option>
<option value="08" <?php submitselect($fbMonth_date, "08")?>>augustus</option>
<option value="09" <?php submitselect($fbMonth_date, "09")?>>september</option>
<option value="10" <?php submitselect($fbMonth_date, "10")?>>oktober</option>
<option value="11" <?php submitselect($fbMonth_date, "11")?>>november</option>
<option value="12" <?php submitselect($fbMonth_date, "12")?>>december</option>
</select>
<!--All the year from 1900 till current year-->
<select name="fbYear_date" autocomplete="bday-year">
<option>Jaar</option>
<?php
$year = (new DateTime)->format("Y");
for($i=$year; $i >= 1900; $i--) {
?>
<option value="<?= $i ?>" <?php submitselect($fbYear_date, $i)?>><?= $i ?></option>
<?php
}
?>
</select>

View File

@@ -20,7 +20,7 @@
name="user"
value="<?php echo $user ?>"
title="Moet een geldige gebruiker zijn"
>
required>
</div>
<!-- Login password -->
@@ -31,7 +31,7 @@
placeholder="Voer uw wachtwoord in"
name="psw"
title="Moet minstens 8 karakters lang zijn"
>
required>
</div>
<!-- Error message -->
@@ -47,73 +47,68 @@
</button>
</div>
<div class="login_containerlogin">
<label><b>Onthoud mij</b></label>
<input type="checkbox" name="rememberMe" value=1><br>
</div>
</form>
</div>
<!-- Button for going to the register screen -->
<!--Vieuws for the modals-->
<div class="login_containerlogin">
<!-- <a href="https://myhyvesbookplus.nl/register" class="button">Registreer een account</a>-->
<?php
include("../views/forgotPasswordModal.php");
include("../views/registerModal.php");
include("../views/facebookRegisterModal.php");
?>
<!--
Below we include the Login Button social plugin. This button uses
the JavaScript SDK to present a graphical Login button that triggers
the FB.login() function when clicked.
-->
<!-- <fb:login-button scope="public_profile,email" onlogin="checkLoginState();"></fb:login-button>-->
<!---->
<!---->
<!-- <span id="fbLogout" onclick="fbLogout()"><a class="fb_button fb_button_medium"><span class="fb_button_text">Logout</span></a></span>-->
<fb:login-button autologoutlink="true"></fb:login-button>
<div id="status">
</div>
</div>
<!--Login with facebook button-->
<?php
if(!isset($acces_token)) {
echo '<div class="login_containerlogin"><a class="fbButton" href="' . $loginurl . '">login with Facebook!</a></div>';
}
?>
<script>
// Get the button that opens the modal
// Get the modal
var modal = document.getElementById('myModal');
var registerModal = document.getElementById('registerModal');
var facebookModal = document.getElementById("fbModal");
// Get the button that opens the modal
var registerBtn = document.getElementById("registerBtn");
var btn = document.getElementById("myBtn");
// Get the modal
var registerModal = document.getElementById('registerModal');
var registerBtn = document.getElementById("registerBtn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
var registerSpan = document.getElementsByClassName("close")[1];
var facebookCLose = document.getElementsByClassName("close")[2];
// When the user clicks the button, open the modal
/**
* When the user clicks the button, open the modal
*/
btn.onclick = function () {
// modal.style.display = "block";
modal.style.display = "block";
window.onload=emailSent();
}
registerBtn.onclick = function () {
registerModal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
/**
* WHen the user clicks on (X), close the modal
*/
span.onclick = function () {
modal.style.display = "none";
}
registerSpan.onclick = function () {
registerModal.style.display = "none";
}
facebookCLose.onclick = function () {
facebookModal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
/**
* When the user clicks anywhere outside of the modal, close it
*/
window.onclick = function (event) {
if (event.target == modal) {
modal.style.display = "none";
@@ -121,5 +116,21 @@ var registerSpan = document.getElementsByClassName("close")[1];
if (event.target == registerModal) {
registerModal.style.display = "none";
}
if (event.target == facebookModal) {
facebookModal.style.display = "none";
}
}
/**
* When ESC is pressed, close modal
*/
document.addEventListener('keyup', function(e) {
if (e.keyCode == 27) {
modal.style.display = "none";
registerModal.style.display = "none";
facebookModal.style.display = "none";
}
});
</script>

View File

@@ -32,7 +32,8 @@
name="name"
value="<?php echo $name ?>"
title="Mag alleen letters bevatten"
>
required
autocomplete="given-name">
*<span class="error"><?php echo $nameErr;?></span>
</div>
@@ -44,7 +45,8 @@
name="surname"
value="<?php echo $surname ?>"
title="Mag alleen letters bevatten"
>
required
autocomplete="family-name">
*<span class="error"> <?php echo $surnameErr;?></span>
</div>
@@ -65,7 +67,7 @@
name="username"
value="<?php echo $username ?>"
title="Moet minimaal 6 karakters bevatten"
>
required>
*<span class="error"> <?php echo $usernameErr;?></span>
<ul>
<li>Minstens 6 karakters</li>
@@ -81,7 +83,7 @@
name="password"
value="<?php echo $password ?>"
id="password"
>
required>
*<span class="error"> <?php echo $passwordErr;?></span>
<ul>
<li>Minstens 8 karakters</li>
@@ -96,7 +98,7 @@
value="<?php echo $confirmpassword ?>"
id="confirmpassword"
title="Herhaal wachtwoord"
>
required>
*<span class="error"> <?php echo $confirmpasswordErr;?></span>
</div>
@@ -109,7 +111,6 @@
value="<?php echo $location ?>"
pattern="[A-Za-z]{1,}"
title="Mag alleen letters bevatten">
*<span class="error"> <?php echo $locationErr;?></span>
</div>
<!-- Register email -->
@@ -120,7 +121,8 @@
name="email"
value="<?php echo $email ?>"
id="email"
title="Voer een geldige email in">
title="Voer een geldige email in"
required>
*<span class="error"> <?php echo $emailErr;?></span>
</div>
@@ -132,10 +134,12 @@
name="confirmEmail"
value="<?php echo $confirmEmail ?>"
id="email"
title="Herhaal uw email">
title="Herhaal uw email"
required>
*<span class="error"> <?php echo $confirmEmailErr;?></span>
</div>
<!-- Captcha confirm -->
<div class="login_containerregister">
<div class="g-recaptcha" data-sitekey="6Lc72xIUAAAAADumlWetgENm7NGd9Npyo0c_tYYQ">
</div>
@@ -145,6 +149,7 @@
</div>
<div class="modal-footer">
<div class="login_containerfault"><span><?php echo $resetErr; ?></span></div>
<!-- Register button -->
<button type="submit"
value="register"
name="submit"