Facebook ID instead of Facebook email

This commit is contained in:
Joey Lai
2017-02-01 12:25:13 +01:00
parent 8e98001217
commit 2b893fc283
11 changed files with 148 additions and 138 deletions

View File

@@ -138,8 +138,6 @@ function resetEmail($variable){
throw new emailException("Verplicht!");
} else if (!filter_var($variable, FILTER_VALIDATE_EMAIL)) {
throw new emailException("Geldige email invullen");
} else if (getResetEmail() == 0){
throw new emailException("Email bestaat niet!");
}
}
@@ -161,7 +159,7 @@ function matchfbPassword(){
/* Checks if captcha is correctly filled in */
function checkCaptcha($captcha){
if(!$captcha){
throw new captchaException("Captcha moet ingevuld worde!");
throw new captchaException("Captcha moet ingevuld worden!");
} else {
$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) {

View File

@@ -72,7 +72,7 @@ function validateLogin($username, $password){
}
}
function fbLogin($email) {
function fbLogin($fbID) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`email`,
@@ -81,16 +81,16 @@ function fbLogin($email) {
FROM
`user`
WHERE
`email` LIKE :email
`facebookID` LIKE :facebookID
");
$stmt->bindValue(":email", $email);
$stmt->bindValue(":facebookID", $fbID);
$stmt->execute();
return $stmt->rowCount();
}
function getfbUserID($email) {
function getfbUserID($fbID) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`userID`,
@@ -98,10 +98,10 @@ function getfbUserID($email) {
FROM
`user`
WHERE
`email` LIKE :email
`facebookID` LIKE :facebookID
");
$stmt->bindValue(":email", $email);
$stmt->bindValue(":facebookID", $fbID);
$stmt->execute();
return $stmt->fetch(PDO::FETCH_ASSOC);
}

View File

@@ -128,6 +128,7 @@ function fbRegisterAccount() {
username,
password,
email,
facebookID,
role)
VALUES(
:fname,
@@ -136,6 +137,7 @@ function fbRegisterAccount() {
:username,
:password,
:email,
:facebookID,
'user'
)");
$fbDay_date = test_input(($_POST["fbDay_date"]));
@@ -149,6 +151,7 @@ function fbRegisterAccount() {
$stmt->bindValue(":lname", test_input($_POST["fbSurname"]));
$stmt->bindValue(":bday", test_input($fbBday));
$stmt->bindValue(":username", test_input($_POST["fbUsername"]));
$stmt->bindValue(":facebookID", test_input($_POST["fbUserID"]));
$stmt->bindValue(":password", test_input($hash));
$stmt->bindValue(":email", test_input(strtolower($_POST["fbEmail"])));