Merge branch 'master' into lars

This commit is contained in:
Lars van Hijfte
2017-02-03 10:15:10 +01:00
12 changed files with 43 additions and 239 deletions

View File

@@ -68,7 +68,7 @@ function validateBday($variable){
}
}
// Checks for date
/* Checks for date */
function validateDate($date, $format)
{
$d = DateTime::createFromFormat($format, $date);
@@ -124,7 +124,7 @@ function validateEmail($variable){
throw new emailException("Mag maximaal 50 karakters!");
}
}
//255
/* checks if an input is a valid email. */
function validateFBEmail($variable){
if (empty($variable)) {
@@ -138,6 +138,7 @@ function validateFBEmail($variable){
}
}
/* checks if email is the same */
function matchEmail(){
if (strtolower($_POST["email"]) != strtolower($_POST["confirmEmail"])){
throw new confirmEmailException("Emails matchen niet!");
@@ -153,7 +154,6 @@ function resetEmail($variable){
}
}
/* checks if two passwords matches. */
function matchPassword(){
if ($_POST["password"] != $_POST["confirmpassword"]) {

View File

@@ -1,5 +1,6 @@
<?php
//Find matching password with the inputted username/emailadress.
function getUser() {
$stmt = prepareQuery("
SELECT
@@ -34,6 +35,7 @@ function getUserID() {
}
function validateLogin($username, $password, $url){
echo $url;
// Empty username or password field
if (empty($username) || empty($password)) {
throw new loginException("Inloggegevens zijn niet ingevuld");
@@ -44,7 +46,7 @@ function validateLogin($username, $password, $url){
$userID = getUser()["userID"];
$role = getUser()["role"];
// If there's an account, go to the profile page
// If there's an account, check if the account is banned, frozen or unconfirmed.
if(password_verify($psw, $hash)) {
if ($role == "banned"){
echo "<script>
@@ -75,8 +77,9 @@ function validateLogin($username, $password, $url){
$_SESSION["userID"] = $userID;
if(!isset($url) or $url == "") {
header("location: profile.php");
echo "succes";
} else{
header("location: $url");
header("location: ".$url);
}
}