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

/**
 * logoutPage.php
 * Sojung Lee & Catherine Matulis
 * May 2014
 * CS304
 *
 * Log a user out and return to the login page
*/
require_once "MDB2.php";
require_once "/home/cs304/public_html/php/MDB2-functions.php";
require_once "/students/cmatulis/public_html/project/blog-functions.php";
require_once "/students/cmatulis/public_html/cs304/cmatulis-dsn.inc";
$dbh = db_connect($cmatulis_dsn);
// destroy the session variable to log the user out
session_start();
session_destroy();
$msg = "";
$resultid = 0;
printPageTop('Poster');
printPageHeader();
?>

</body>
</html>

Пример #2
0
require_once "/students/cmatulis/public_html/cs304/cmatulis-dsn.inc";
$dbh = db_connect($cmatulis_dsn);
session_start();
// if a user is not currently logged in, redirect to the home page
if (!isset($_SESSION['user'])) {
    header('Location: blog-login.php');
}
$user = $_SESSION['user'];
?>
 

<!DOCTYPE html>
<html lang="en">

<?php 
printPageTop('profile');
?>

    	<div class="blog-masthead">
      		<div class="container">
        		<nav class="blog-nav">
          			<ul class="nav navbar-nav">
            				<li><a class="blog-nav-item" href="blog-ex-comment-user.php">Blog</a></li>
            				<li><a class="blog-nav-item" href = "postPage.php?type=">Post</a></li>
            				<li><a class="blog-nav-item" href="followersPage.php">Followers</a></li>
            				<li><a class="blog-nav-item" href="followingPage.php">Following</a></li>
            				<li><a class="blog-nav-item active" href ="#">Profile</a></li>
            				<li><a class="blog-nav-item" href = "toHomePage.php">Home</a></li>
            				<li><a class="blog-nav-item" href = "logoutPage.php">Logout</a></li>
          			</ul>
          			<form class="navbar-form navbar-right" role="search" action="searchResults.php">
Пример #3
0
<?php

/**
 * toHomePage.php
 * Sojung Lee & Catherine Matulis
 * May 2014
 * CS304
 *
 * Calls the functions to print the home page of Poster, 
 * which is the page that a user will see when they log in, allowing them
 * to view their own blog or view all posts from other users
*/
require_once "MDB2.php";
require_once "/home/cs304/public_html/php/MDB2-functions.php";
require_once "/students/cmatulis/public_html/project/blog-functions.php";
require_once "/students/cmatulis/public_html/cs304/cmatulis-dsn.inc";
$dbh = db_connect($cmatulis_dsn);
session_start();
// if a user is not currently logged in, redirect to the login page
if (!isset($_SESSION['user'])) {
    header('Location: blog-login.php');
}
$poster = $_SESSION['user'];
printPageTop('Home');
printNext($poster);
?>

</body>
</html>
Пример #4
0
function printFollowingPage($dbh, $user)
{
    printPageTop('Following');
    print <<<EOT
\t<div class="blog-masthead">
       \t<div class="container">
         \t\t<nav class="blog-nav">
           \t\t\t<ul class="nav navbar-nav">
             \t\t\t\t<li><a class="blog-nav-item" href="blog-ex-comment-user.php">Blog</a></li>
             \t\t\t\t<li><a class="blog-nav-item" href = "postPage.php?type=">Post</a></li>
             \t\t\t\t<li><a class="blog-nav-item" href="followersPage.php">Followers</a></li>
             \t\t\t\t<li><a class="blog-nav-item active" href="#">Following</a></li>
             \t\t\t\t<li><a class="blog-nav-item" href ="myprofile.php">Profile</a></li>
             \t\t\t\t<li><a class="blog-nav-item" href = "toHomePage.php">Home</a></li>
             \t\t\t\t<li><a class="blog-nav-item" href = "logoutPage.php">Logout</a></li>
           \t\t\t</ul>
EOT;
    printSearchForm();
    print <<<EOT
        \t\t</nav>
      \t\t</div>
    </div>

EOT;
    print <<<EOT
    \t<div class="container">
      \t\t<div class="blog-header">
        \t\t<h1 class="blog-title">{$user}</h1>
        \t\t<p class="lead blog-description">Here are the users that you are following.</p>
      \t\t</div>

      \t\t<div class="row">
\t\t\t<div class="col-sm-8 blog-main">
EOT;
    // Get a list of users that you are currently following and display on page
    $getFollowing = "SELECT following FROM follows where user = ?";
    $followingResults = prepared_query($dbh, $getFollowing, $user);
    while ($row = $followingResults->fetchRow(MDB2_FETCHMODE_ASSOC)) {
        $following = $row['following'];
        print <<<EOT
        
          \t<div class="blog-post">
            \t\t<p class="blog-post-meta"><a href="toBlog.php?user={$following}">{$following}</a></p>
            \t\t<hr>
\t\t</div>    
EOT;
    }
    print <<<EOT
\t\t</div><!-- /.blog-main -->  
    \t\t</div><!-- /.container -->
EOT;
    printBlogFooter();
}
Пример #5
0
require_once "/students/cmatulis/public_html/project/blog-functions.php";
require_once "/students/cmatulis/public_html/cs304/cmatulis-dsn.inc";
$dbh = db_connect($cmatulis_dsn);
session_start();
// if the user is not logged in, redirect to the login page
if (!isset($_SESSION['user'])) {
    header('Location: blog-login.php');
}
$query = mysql_real_escape_string($_REQUEST['searchentry']);
?>

<!DOCTYPE html>
<html lang="en">

<?php 
printPageTop("Search Results");
?>

	<div class="blog-masthead">
      		<div class="container">
        		<nav class="blog-nav">
          			<ul class="nav navbar-nav">
            				<li><a class="blog-nav-item" href="blog-ex-comment-user.php">Blog</a></li>
            				<li><a class="blog-nav-item" href = "postPage.php?type=">Post</a></li>
            				<li><a class="blog-nav-item" href="followersPage.php">Followers</a></li>
            				<li><a class="blog-nav-item" href="followingPage.php">Following</a></li>
            				<li><a class="blog-nav-item" href ="myprofile.php">Profile</a></li>
            				<li><a class="blog-nav-item" href = "toHomePage.php">Home</a></li>
            				<li><a class="blog-nav-item" href = "logoutPage.php">Logout</a></li>
          			</ul>
				<?php 
Пример #6
0
session_start();
// if there is not a user currently logged in, redirect to the login page
if (!isset($_SESSION['user'])) {
    header('Location: blog-login.php');
}
$user = $_SESSION['user'];
// if the user has arrived at this page after updating their profile, update the database
saveInfo($dbh, $user);
?>
 

<!DOCTYPE html>
<html lang="en">

<?php 
printPageTop('Profile');
?>

	<div class="blog-masthead">
      		<div class="container">
        		<nav class="blog-nav">
          			<ul class="nav navbar-nav">
            				<li><a class="blog-nav-item" href="blog-ex-comment-user.php">Blog</a></li>
            				<li><a class="blog-nav-item" href = "postPage.php?type=">Post</a></li>
            				<li><a class="blog-nav-item" href="followersPage.php">Followers</a></li>
            				<li><a class="blog-nav-item" href="followingPage.php">Following</a></li>
            				<li><a class="blog-nav-item active" href ="#">Profile</a></li>
            				<li><a class="blog-nav-item" href = "toHomePage.php">Home</a></li>
            				<li><a class="blog-nav-item" href = "logoutPage.php">Logout</a></li>
          			</ul>
				<?php 
Пример #7
0
require_once "/students/cmatulis/public_html/cs304/cmatulis-dsn.inc";
$dbh = db_connect($cmatulis_dsn);
session_start();
// if a user is not currently logged in, redirect to the login page
if (!isset($_SESSION['user'])) {
    header('Location: blog-login.php');
}
$user = $_GET['user'];
?>
 

<!DOCTYPE html>
<html lang="en">

	<?php 
printPageTop("Profile");
print <<<EOT

    \t<div class="blog-masthead">
      \t\t<div class="container">
        \t\t<nav class="blog-nav">
          \t\t\t<ul class="nav navbar-nav">
            \t\t\t\t<li><a class="blog-nav-item" href="toBlog.php?user={$user}">Blog</a></li>
            \t\t\t\t<li><a class="blog-nav-item active" href ="#">Profile</a></li>
            \t\t\t\t<li><a class="blog-nav-item" href = "toHomePage.php">Home</a></li>
            \t\t\t\t<li><a class="blog-nav-item" href = "logoutPage.php">Logout</a></li>
          \t\t\t</ul>
EOT;
printSearchForm();
?>
        		</nav>