Merge branch 'master' into marijn-groups
This commit is contained in:
@@ -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"]) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
//Find matching password with the inputted username/emailadress.
|
||||
function getUser() {
|
||||
$stmt = prepareQuery("
|
||||
SELECT
|
||||
@@ -33,7 +34,8 @@ function getUserID() {
|
||||
return $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
function validateLogin($username, $password){
|
||||
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,26 +46,42 @@ function validateLogin($username, $password){
|
||||
$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>
|
||||
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");
|
||||
echo "succes";
|
||||
} else{
|
||||
header("location: ".$url);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
throw new loginException("Inloggevens zijn niet correct");
|
||||
|
||||
@@ -6,18 +6,23 @@ function getOldChatMessages($user2ID) {
|
||||
if (getFriendshipStatus($user2ID) == 1) {
|
||||
$stmt = prepareQuery("
|
||||
SELECT
|
||||
*
|
||||
*
|
||||
FROM
|
||||
`private_message`
|
||||
WHERE
|
||||
`origin` = :user1 AND
|
||||
`destination` = :user2 OR
|
||||
`origin` = :user2 AND
|
||||
`destination` = :user1
|
||||
(SELECT
|
||||
*
|
||||
FROM
|
||||
`private_message`
|
||||
WHERE
|
||||
`origin` = :user1 AND
|
||||
`destination` = :user2 OR
|
||||
`origin` = :user2 AND
|
||||
`destination` = :user1
|
||||
ORDER BY
|
||||
`messageID` DESC
|
||||
LIMIT
|
||||
100) sub
|
||||
ORDER BY
|
||||
`creationdate` ASC
|
||||
LIMIT
|
||||
100
|
||||
`messageID` ASC
|
||||
");
|
||||
|
||||
$stmt->bindParam(":user1", $user1ID);
|
||||
@@ -76,7 +81,7 @@ function getNewChatMessages($lastID, $destination) {
|
||||
`destination` = :user1) AND
|
||||
`messageID` > :lastID
|
||||
ORDER BY
|
||||
`creationdate` ASC
|
||||
`messageID` ASC
|
||||
");
|
||||
|
||||
$stmt->bindParam(':user1', $_SESSION["userID"]);
|
||||
|
||||
Reference in New Issue
Block a user