include_once "dbconnect.php"; //grab all topics, but sort them by descending order based on "last post" $post_query = "SELECT * FROM posts WHERE topic_id = '{$topic_id}' ORDER BY id ASC"; $post_result = $conn->query($post_query); $responses = $post_result->num_rows; if ($responses == 0) { //not a valid topic $post_result->free(); giveError("Invalid Post"); } else { if (isset($_GET['u'])) { if (is_numeric($_GET['u'])) { $filtered_user = $_GET['u']; } } $user_array = generateUserArray(); //board_functions include_once "board_header.php"; //board_functions while ($post = $post_result->fetch_assoc()) { //check to see if post has been edited if ($post['edited'] > 0) { $edited = array('exist' => true, 'times' => $post['edited'], 'id' => $post['id']); } else { $edited = array('exist' => false); } $poster = matchUserIdToUsername($post['post_creator_id'], $user_array); //board_functions $date = formatTime($post['post_time']); $details = array('exist' => true, 'id' => $post['id'], 'topic_id' => $topic_id); if (!isset($filtered_user)) {
<?php include_once "board_functions.php"; $user_array = generateUserArray($conn); //board_functions $user = matchUserIdToUsername($_SESSION['id'], $user_array); $user_query = "SELECT * FROM members WHERE username='******'"; $user_result = $conn->query($user_query); while ($user = $user_result->fetch_assoc()) { if (!isset($_GET['topic_id'])) { //not in a topic echo "<center>"; echo "<a href='profile.php?id=" . $user['id'] . "'>" . $user['username'] . "</a> | <a href='postmsg.php'>Create New Topic</a> | <a href='logout.php'>Logout</a>"; echo "</center>"; } else { echo "<center>"; echo "<a href='profile.php?id=" . $user['id'] . "'>" . $user['username'] . "</a> | <a href='topiclist.php'>Topic List</a> | <a href='postmsg.php?topic_id=" . $_GET['topic_id'] . "'>Reply</a> | <a href='logout.php'>Logout</a>"; echo "</center>"; } echo "<br>"; }