Merge branch 'joey-testing' into 'master'

Added url get

See merge request !193
This commit was merged in pull request #197.
This commit is contained in:
Lars van Hijfte
2017-02-02 21:03:03 +01:00
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");