summaryrefslogtreecommitdiff
path: root/create_thread.php
diff options
context:
space:
mode:
authorh5p9sl <21267024+h5p9sl@users.noreply.github.com>2021-05-13 22:07:11 -0600
committerh5p9sl <21267024+h5p9sl@users.noreply.github.com>2021-05-14 02:37:13 -0600
commitfe41f57df59c7f2a11d80eaaebf08d3a3a51a6d5 (patch)
tree8917741bbe991d6ddf4f23953309288975f56eb2 /create_thread.php
parent4145fa13230d25d9978c003a8cccd1b7c2e11aaf (diff)
Add error handling
Diffstat (limited to 'create_thread.php')
-rw-r--r--create_thread.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/create_thread.php b/create_thread.php
index 6fb7df9..a203b39 100644
--- a/create_thread.php
+++ b/create_thread.php
@@ -10,6 +10,7 @@
<h2>Create a new thread</h2>
<?php
include_once 'includes/Session.php';
+include_once 'includes/error.php';
if (!Session::get()->is_signed_in()) {
trigger_error('You must be <a href="signin.php">signed in</a> to create a thread.');
exit();
@@ -44,6 +45,7 @@ if (!Session::get()->is_signed_in()) {
<?php
include_once 'includes/functions_post.php';
include_once 'includes/functions_thread.php';
+include_once 'includes/error.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$post_content = filter_input(INPUT_POST, 'post_content', FILTER_SANITIZE_STRING);
@@ -51,7 +53,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$thread_cat = filter_input(INPUT_POST, 'thread_cat', FILTER_SANITIZE_NUMBER_INT);
if (empty($thread_subject) or !$thread_subject) {
- echo 'Thread subject cannot be empty';
+ trigger_error('Thread subject cannot be empty');
} else {
$thread_id = create_thread($thread_subject, $thread_cat);
create_post($post_content, $thread_id, $thread_cat);