summaryrefslogtreecommitdiff
path: root/topic.php
diff options
context:
space:
mode:
Diffstat (limited to 'topic.php')
-rw-r--r--topic.php36
1 files changed, 23 insertions, 13 deletions
diff --git a/topic.php b/topic.php
index 216211f..751370b 100644
--- a/topic.php
+++ b/topic.php
@@ -1,6 +1,6 @@
-<?php
+<?php include_once 'header.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']);
@@ -40,18 +40,28 @@ if (mysqli_num_rows($result) == 0) {
echo '<td class="left">' . $row['post_content'] . '</td></tr>';
}
echo '</table>';
-
- 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>';
}
mysqli_free_result($result);
-include 'footer.php'; \ No newline at end of file
+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