diff options
Diffstat (limited to 'topic.php')
-rw-r--r-- | topic.php | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/topic.php b/topic.php deleted file mode 100644 index 751370b..0000000 --- a/topic.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php include_once 'header.php'; ?> - -<?php -include_once 'includes/db_inc.php'; - -$sql = "SELECT topic_id, topic_subject, topic_date, user_id, user_name FROM topics LEFT JOIN users ON topic_author = user_id WHERE topic_id = " . mysqli_real_escape_string($dbc, $_GET['id']); -$result = mysqli_query($dbc, $sql); - -if (!$result) { - die('Error trying to display topic page: ' . mysqli_error()); -} - -if (mysqli_num_rows($result) == 0) { - echo 'This topic does not exist'; -} else { - while ($row = mysqli_fetch_assoc($result)) { - echo '<section><h1>' . $row['topic_subject'] . '</h1>'; - echo 'Created by <b>' . $row['user_name'] . '</b> on ' . date('M d, Y', strtotime($row['topic_date'])) . '</section>'; - $topic_id = $row['topic_id']; - } -} - -echo '</section>'; - -mysqli_free_result($result); - -$sql = "SELECT post_content, post_date, post_author, user_id, user_name FROM posts LEFT JOIN users ON post_author = user_id WHERE post_topic = " . mysqli_real_escape_string($dbc, $_GET['id']); -$result = mysqli_query($dbc, $sql); - -if (!$result) { - die('Error trying to display posts: ' . mysqli_error($dbc)); -} - -if (mysqli_num_rows($result) == 0) { - echo '<section>This topic has no posts</section>'; -} else { - echo '<table>'; - while ($row = mysqli_fetch_assoc($result)) { - echo '<tr class="post"><td class="right">Posted by <b>' . $row['user_name'] . '</b><br><small>' . date('m/d/Y g:ia', strtotime($row['post_date'])) . '</small></td>'; - echo '<td class="left">' . $row['post_content'] . '</td></tr>'; - } - echo '</table>'; -} - -mysqli_free_result($result); - -if (isset($_SESSION['signed_in'])) { - echo ' - <section> - <form action="includes/reply_inc.php?reply_to=' . $topic_id .'>" method="post"> - <h2>Reply to this thread</h2> - <textarea name="reply_content"></textarea> - <br> - <input type="submit" name="submit"> - </form> - </section> - '; -} else { - echo ' - <section> - <a href="signin.php">Sign in</a> to reply to this thread</a> - </section> - '; -} - -include_once 'footer.php'; -?>
\ No newline at end of file |