From df9177492976ba968a556a52cc155477652089dc Mon Sep 17 00:00:00 2001 From: cflip <36554078+cflip@users.noreply.github.com> Date: Sun, 25 Apr 2021 17:47:41 -0600 Subject: Reload page after submitting a reply to a thread --- create_thread.php | 1 - includes/reply_inc.php | 22 ---------------------- viewthread.php | 1 + 3 files changed, 1 insertion(+), 23 deletions(-) delete mode 100644 includes/reply_inc.php diff --git a/create_thread.php b/create_thread.php index 2ed323d..6fb7df9 100644 --- a/create_thread.php +++ b/create_thread.php @@ -56,7 +56,6 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { $thread_id = create_thread($thread_subject, $thread_cat); create_post($post_content, $thread_id, $thread_cat); - header("Location: viewthread.php?id=" . $thread_id); } } diff --git a/includes/reply_inc.php b/includes/reply_inc.php deleted file mode 100644 index 873d516..0000000 --- a/includes/reply_inc.php +++ /dev/null @@ -1,22 +0,0 @@ -is_signed_in()) { - die('You must be signed in to reply to a thread.'); -} - -$reply_content = filter_input(INPUT_POST, 'reply_content', FILTER_SANITIZE_STRING); -$thread_id = filter_input(INPUT_POST, 'reply_to', FILTER_SANITIZE_NUMBER_INT); - -$thread = new Thread(); -$thread->get_from_database($thread_id); - -create_post($reply_content, $thread_id, $thread->category); - -header("Location: ../thread.php?id=" . $_GET['reply_to']); \ No newline at end of file diff --git a/viewthread.php b/viewthread.php index 812db0a..e8eda06 100644 --- a/viewthread.php +++ b/viewthread.php @@ -90,6 +90,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { echo 'Thread subject cannot be empty'; } else { create_post($post_content, $current->id, $current->category->id); + header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $current->id); } } ?> -- cgit v1.2.3