From f78ad3e81c2bf8dca6b491ee8f09b99d40903d77 Mon Sep 17 00:00:00 2001
From: h5p9sl <21267024+h5p9sl@users.noreply.github.com>
Date: Sun, 24 Jan 2021 11:07:53 -0700
Subject: Disallow empty thread subjects
---
create_thread.php | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
(limited to 'create_thread.php')
diff --git a/create_thread.php b/create_thread.php
index 3f15f63..51bfe10 100644
--- a/create_thread.php
+++ b/create_thread.php
@@ -39,7 +39,6 @@ if (!isset($_SESSION['signed_in'])) {
-
Thread subject cannot be empty.';
+ } else {
+ create_thread($dbc, $thread_subject, $thread_cat, $user_id);
+ $thread_id = mysqli_insert_id($dbc);
+ $post_result = create_post($dbc, $post_content, $thread_id, $user_id);
+ if (!$post_result) {
+ echo 'An error occurred creating your post: ' . mysqli_error($dbc);
+ } else {
+ header("Location: thread.php?id=" . $thread_id);
+ }
}
-
- header("Location: thread.php?id=" . $thread_id);
}
?>
-
\ No newline at end of file
+
+
+
--
cgit v1.2.3