summaryrefslogtreecommitdiff
path: root/viewthread.php
diff options
context:
space:
mode:
Diffstat (limited to 'viewthread.php')
-rw-r--r--viewthread.php19
1 files changed, 10 insertions, 9 deletions
diff --git a/viewthread.php b/viewthread.php
index e8eda06..fa1c81b 100644
--- a/viewthread.php
+++ b/viewthread.php
@@ -68,29 +68,30 @@ foreach ($posts as $post) {
?>
<hr>
<h2>Reply to this thread</h2>
-<form method="post">
- <textarea name="post_content" rows="10" cols="50"></textarea>
- <br>
- <input type="submit" name="submit">
-</form>
-</body>
-</html>
<?php
include_once 'includes/functions_post.php';
+include_once 'includes/error.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (!Session::get()->is_signed_in()) {
- echo 'You must be <a href="signin.php">signed in</a> to reply to this thread.';
+ trigger_error('You must be <a href="signin.php">signed in</a> to reply to this thread.', E_USER_NOTICE);
return;
}
$post_content = filter_input(INPUT_POST, 'post_content', FILTER_SANITIZE_STRING);
if (empty($post_content) or !$post_content) {
- echo 'Thread subject cannot be empty';
+ trigger_error('Reply cannot be empty');
} else {
create_post($post_content, $current->id, $current->category->id);
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $current->id);
}
}
?>
+<form method="post">
+ <textarea name="post_content" rows="10" cols="50"></textarea>
+ <br>
+ <input type="submit" name="submit">
+</form>
+</body>
+</html>