Exemplo n.º 1
0
?>
<div id = "posts_all">
<?php 
echo $posts;
echo "<br><br><br>";
?>
</div>

<br>
<br>
<br>
<br>
<div id = "friend_container">
<h2>My Connections:</h2>
<?php 
$friends = database_get_friends($userID);
for ($i = 0; $i < sizeof($friends); $i++) {
    $uid = $friends[$i];
    $username = database_get_username($uid);
    echo "<div id = 'user'>";
    echo "<a href = 'user.php?userID={$uid}'>";
    echo "<img width = '100' src = 'show_picture.php?id={$uid}'><br />";
    echo $username;
    echo "</a>";
    echo "</div>";
}
?>
</div>


</div>
Exemplo n.º 2
0
function database_show_friend_posts($userID)
{
    global $mysqli;
    // Print out the most recent post from each friend
    // Get all of the friends for this user
    $friends = database_get_friends($userID);
    array_push($friends, $userID);
    // Also show this user's posts
    $s = "";
    // Print the most recent post from each friend
    for ($i = 0; $i < sizeof($friends); $i++) {
        $uID = $friends[$i];
        $q = "SELECT users.username, posts.message, posts.timestamp FROM users, posts ";
        $q = $q . "WHERE posts.userID='{$uID}' AND users.userID='{$uID}' ";
        $q = $q . "ORDER BY posts.timestamp DESC LIMIT 2";
        $result = mysqli_query($mysqli, $q);
        while ($row = mysqli_fetch_row($result)) {
            if ($row[0] != "") {
                $s = $s . "<h1><a href='user.php?userID={$uID}'> " . $row[0] . "</a> </h1>" . $row[2] . " &nbsp; &nbsp;" . $row[1] . "<br /><br />";
            }
        }
    }
    echo $s;
}