$topic_result = $conn->query($topic_query); $user_array = generateUserArray(); //board_functions //begin topic table include_once "board_header.php"; echo "<table class='pure-table pure-table-bordered' width=80%>"; echo "<thead>"; echo "<tr>"; echo "<th width='70%'>Topics</th>"; echo "<th>Posted By</th>"; echo "<th>Last Post</th>"; echo "</tr>"; echo "</thead>"; echo " "; echo "<tbody>"; while ($topic = $topic_result->fetch_assoc()) { $tc = matchUserIdToUsername($topic['topic_creator_id'], $user_array); //board_functions $date = formatTime($topic['last_post']); //board_functions echo "<tr>"; echo "<td><a href='showmsg.php?topic_id=" . $topic['id'] . "'>" . $topic['subject'] . "</a></td>"; echo "<td>{$tc}</td>"; echo "<td>" . $date . "</td>"; echo "</tr>"; } echo "</tbody>"; echo "</table>"; $topic_result->free(); $conn->close(); }
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)) { $filtered = array('exist' => false, 'pc_id' => $post['post_creator_id'], 'topic_id' => $topic_id, 'id' => $post['id']); $header = assemblePostHeader($poster, $post['post_creator_id'], $date, $details, $edited, $filtered); assemblePost($header, $post['post_content']); //board_functions } else { if ($post['post_creator_id'] == $filtered_user) { $filtered = array('exist' => true, 'pc_id' => $post['post_creator_id'], 'topic_id' => $topic_id, 'id' => $post['id']); $header = assemblePostHeader($poster, $post['post_creator_id'], $date, $details, $edited, $filtered); assemblePost($header, $post['post_content']); //board_functions }
<?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>"; }