Merge branch 'master' into kevin-prototype
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.friend-item:hover {
|
||||
.friend-item:hover, .group-item:hover {
|
||||
background: #845663;
|
||||
color: white;
|
||||
}
|
||||
|
||||
@@ -170,4 +170,30 @@ function changeUserStatusByID($id, $status) {
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
function selectRandomNotFriendUser($userID) {
|
||||
$stmt = $GLOBALS["db"]->prepare("
|
||||
SELECT
|
||||
`user`.`username`
|
||||
FROM
|
||||
`user`
|
||||
WHERE
|
||||
`userID` NOT IN (SELECT
|
||||
`user1ID`
|
||||
FROM
|
||||
`friendship`
|
||||
WHERE `user1ID` = :userID) OR
|
||||
`userID` NOT IN (SELECT
|
||||
`user2ID`
|
||||
FROM
|
||||
`friendship`
|
||||
WHERE `user2ID` = :userID)
|
||||
ORDER BY
|
||||
RAND()
|
||||
LIMIT
|
||||
1
|
||||
");
|
||||
|
||||
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
return $stmt->fetch();
|
||||
}
|
||||
@@ -15,7 +15,8 @@
|
||||
</style>
|
||||
<?php
|
||||
|
||||
include_once("../queries/connect.php");
|
||||
require_once ("../queries/checkInput.php");
|
||||
require_once ("../queries/connect.php");
|
||||
|
||||
session_start();
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
<?php
|
||||
|
||||
// Load file.
|
||||
include_once("../queries/friendship.php");
|
||||
require_once("../queries/friendship.php");
|
||||
require_once("../queries/user.php");
|
||||
|
||||
// Get all the friends of a user.
|
||||
$friends = selectAllFriends($_SESSION["userID"]);
|
||||
@@ -45,13 +46,31 @@
|
||||
</li>
|
||||
";
|
||||
}
|
||||
|
||||
$randomUser = selectRandomNotFriendUser($_SESSION["userID"])["username"];
|
||||
|
||||
echo "
|
||||
<li class='friend-item'>
|
||||
<form action='profile.php' method='get'>
|
||||
<button type='submit'
|
||||
name='username'
|
||||
value='$randomUser'>
|
||||
<div class='friend'>
|
||||
Klik hier voor een nieuw vriendje :)
|
||||
</div>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
";
|
||||
if ($i > 1) {
|
||||
$i -= 1;
|
||||
echo "
|
||||
<li class='more-item' id='more-friends-click'>
|
||||
En nog $i anderen...
|
||||
</li>";
|
||||
<li class='more-item' id='more-friends-click'>
|
||||
En nog $i anderen...
|
||||
</li>
|
||||
";
|
||||
}
|
||||
|
||||
?>
|
||||
</ul>
|
||||
</section>
|
||||
@@ -87,17 +106,28 @@
|
||||
|
||||
// Echo the friend.
|
||||
echo "
|
||||
<a href='#' class='$extraItem'>
|
||||
<li class='group-item'>
|
||||
<div class='group'>
|
||||
<img alt='PF' class='group-picture' src='$picture'/>
|
||||
$name
|
||||
</div>
|
||||
</li>
|
||||
</a>
|
||||
<li class='group-item'>
|
||||
<form action='group.php' method='get'>
|
||||
<button type='submit'
|
||||
name='groupname'
|
||||
value='$name'>
|
||||
<div class='group'>
|
||||
<img alt='PF' class='group-picture' src='$picture'/>
|
||||
$name
|
||||
</div>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
";
|
||||
}
|
||||
if ($i > 3) {
|
||||
|
||||
if ($i == 0) {
|
||||
echo "<li class='group-item'>
|
||||
<div class='group'>
|
||||
Je hoort nergens bij.
|
||||
</div>
|
||||
</li>";
|
||||
} else if ($i > 3) {
|
||||
$i -= 3;
|
||||
echo "
|
||||
<li class='more-item' id='more-groups-click'>
|
||||
|
||||
Reference in New Issue
Block a user