Пример #1
0
<?php

include "database_queries.php";
// Get the message to post
$post = $_POST["post"];
// Get the user logged in
$userID = get_user_logged_in();
// Insert the new post into the database for that user
// call the database_add_user_post function and provide the variables
// $userID and $post
database_add_user_post($userID, $post);
// Go back to the user's page
header('Location: user.php?userID=' . $userID);
?>

Пример #2
0
<?php

include "top.php";
// Get the userID to display
$userID = $_GET["userID"];
// NOTE:  Here you can use your new database query function to get
// more fields from the database
$username = database_get_username($userID);
$phone = database_get_phone($userID);
//Get the posts from this userID
$posts = database_get_user_posts($userID);
$loggedInUser = get_user_logged_in();
// See if we should add the friend
if (!empty($_GET["addfriend"])) {
    add_friend($loggedInUser, $userID);
}
?>
<!-- Start the content for this user -->
<div id = "container">
<div id = "picture">
<?php 
echo "<img width='120' height ='130' src='show_picture.php?id={$userID}'>";
if ($loggedInUser != 0) {
    // Show the add friend link if this user is not the same user that is logged in
    if ($loggedInUser != $userID) {
        echo "<br /><div id = 'addfriend'><a href = 'user.php?userID={$userID}&addfriend=1'> Add Friend </a></div>";
    }
}
?>
</div>