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

@@ -19,6 +19,10 @@ function checkInputChoice($variable, $option){
username($variable);
break;
case "fbUsername";
fbUsername($variable);
break;
case "longerEight";
longerEight($variable);
break;
@@ -27,6 +31,10 @@ function checkInputChoice($variable, $option){
validateEmail($variable);
break;
case "fbEmail";
validateFBEmail($variable);
break;
default:
break;
@@ -76,6 +84,17 @@ function username($variable){
}
}
/* checks if username exist and if its longer than 6 characters. */
function fbUsername($variable){
if (empty($variable)) {
throw new usernameException("Verplicht!");
} else if (strlen($variable) < 6) {
throw new usernameException("Moet minstens 6 karakters bevatten");
} else if (getExistingFBUsername() == 1) {
throw new usernameException("Gebruikersnaam bestaal al");
}
}
/* checks if an input is longer that 8 characters. */
function longerEight($variable){
if (empty($variable)) {
@@ -96,6 +115,17 @@ function validateEmail($variable){
}
}
/* checks if an input is a valid email. */
function validateFBEmail($variable){
if (empty($variable)) {
throw new emailException("Verplicht!");
} else if (!filter_var($variable, FILTER_VALIDATE_EMAIL)) {
throw new emailException("Geldige email invullen");
} else if (getExistingFBEmail() == 1){
throw new emailException("Email bestaal al!");
}
}
function matchEmail(){
if (strtolower($_POST["email"]) != strtolower($_POST["confirmEmail"])){
throw new confirmEmailException("Emails matchen niet!");
@@ -121,6 +151,13 @@ function matchPassword(){
}
}
/* checks if two fbPasswords matches. */
function matchfbPassword(){
if ($_POST["fbPassword"] != $_POST["fbConfirmpassword"]) {
throw new fbConfirmPasswordException("Wachtwoorden matchen niet!");
}
}
/* Checks if captcha is correctly filled in */
function checkCaptcha($captcha){
if(!$captcha){
@@ -154,6 +191,16 @@ function registerCheck($status){
}
}
/* Checks if everything is filled in correctly */
function fbRegisterCheck($status){
if ($status == false){
throw new registerException("Bepaalde velden zijn verkeerd of niet ingevuld");
} else {
fbRegisterAccount();
header("location: login.php");
}
}
/* removes weird characters of an input. */
function test_input($data) {
$data = trim($data);
@@ -203,6 +250,14 @@ class confirmPasswordException extends Exception
}
}
class fbConfirmPasswordException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
class emailException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)