Changed style and added friendrequests

This commit is contained in:
Lars van Hijfte
2017-01-23 11:33:27 +01:00
parent 71202ab857
commit 93b6835ea4
16 changed files with 178 additions and 47 deletions

View File

@@ -22,11 +22,42 @@ function selectAllFriends($userID) {
`friendship`.`user2ID` = :userID AND
`friendship`.`user1ID` = `user`.`userID`) AND
`role` != 5 AND
`status` = 1
`status` = 1
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
}
function selectAllFriendRequests() {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`userID`,
`username`,
IFNULL(
`profilepicture`,
'../img/notbad.jpg'
) AS profilepicture,
`onlinestatus`,
`role`
FROM
`user`
INNER JOIN
`friendship`
WHERE
(`friendship`.`user1ID` = :userID AND
`friendship`.`user2ID` = `user`.`userID` OR
`friendship`.`user2ID` = :userID AND
`friendship`.`user1ID` = `user`.`userID`) AND
`role` != 5 AND
`status` = 0
");
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);
$stmt->execute();
return json_encode($stmt->fetchAll());
}