Added url get

This commit is contained in:
Joey Lai
2017-02-02 19:34:58 +01:00
parent 044ed6a9d3
commit 1486e71207
7 changed files with 110 additions and 206 deletions

View File

@@ -33,7 +33,7 @@ function getUserID() {
return $stmt->fetch(PDO::FETCH_ASSOC);
}
function validateLogin($username, $password){
function validateLogin($username, $password, $url){
// Empty username or password field
if (empty($username) || empty($password)) {
throw new loginException("Inloggegevens zijn niet ingevuld");
@@ -50,20 +50,35 @@ function validateLogin($username, $password){
echo "<script>
window.onload=bannedAlert();
</script>";
} else if ($role == "frozen"){
} else if ($role == "frozen") {
$_SESSION["userID"] = $userID;
if (!isset($url) or $url = "") {
echo "<script>
window.onload=frozenAlert();
window.location.href= 'profile.php';
</script>";
} else {
echo "<script>
window.onload=frozenAlert();
window.location.href= $url;
</script>";
}
} else if ($role == "unconfirmed"){
sendConfirmEmail(getUser()["userID"]);
echo "<script>
window.onload=emailNotConfirmed();
</script>";
} else {
$_SESSION["userID"] = $userID;
header("location: profile.php");
if(!isset($url) or $url == "") {
header("location: profile.php");
} else{
header("location: $url");
}
}
} else {
throw new loginException("Inloggevens zijn niet correct");