Log in
Hello " . $_SESSION['username'] . ""; echo "
Your name " . $_SESSION['name'] . "
"; ?>
Home
Post a post
Your posts
All posts
Post
Text post
'; break; case 'userPosts': $posts = $db->getUserPosts($_SESSION['uid']); echo "
Your Posts
"; foreach ($posts as $post) { echo "
From: " . $_SESSION['username'] . "
"; echo "
" . $post['post_txt'] . "
"; echo "
" . $post['date'] . "
"; include("../inc/comment.html"); } echo "
"; break; case 'allPosts': $posts = $db->getAllPosts(); echo "
All Posts
"; foreach ($posts as $post) { echo "
From: " . $post['username'] . "
"; echo "
" . $post['post_txt'] . "
"; echo "
" . $post['date'] . "
"; echo "
Interact
"; } echo "
"; break; case 'postInteract': $_SESSION['pid'] = $_GET['pid']; $post = $db->getPost($_GET['pid']); $comments = $db->getComments($_GET['pid']); echo "
Post
"; echo "
From: " . $post['username'] . "
"; echo "
" . $post['post_txt'] . "
"; echo "
" . $post['date'] . "
"; echo "
All comments
"; foreach ($comments as $comment) { echo "
From: " . $comment['username'] . "
"; echo "
" . $comment['comment_txt'] . "
"; echo "
" . $comment['date'] . "
"; } echo "
"; include("../inc/comment.html"); echo "
"; break; case 'comment': if($_POST['comment'] != '') $db->postComment($_SESSION['pid'], $_SESSION['uid'], $_POST['comment']); header("Location: index.php?action=postInteract&pid=" . $_SESSION['pid']); break; default: } } } else echo "
No good
"; ?>