From 424622fbdbe7065cb5b93b39d6cfc5ba0a31775e Mon Sep 17 00:00:00 2001 From: cflip <36554078+cflip@users.noreply.github.com> Date: Mon, 12 Apr 2021 09:56:22 -0600 Subject: Begin post moderation, add delete feature --- moderate.php | 33 +++++++++++++++++++++++++++++++++ viewthread.php | 26 ++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 moderate.php diff --git a/moderate.php b/moderate.php new file mode 100644 index 0000000..afeefa1 --- /dev/null +++ b/moderate.php @@ -0,0 +1,33 @@ +get_by_id($_SESSION['user_id'], $dbc); + + if ($user->level > 0) { + if (strcasecmp($delete, "on") == 0) { + delete_thread($dbc, $thread_id); + + header("Location: /"); + exit(); + } + } + + header("Location: viewthread.php?id=$thread_id"); + exit(); +} + +header("Location: /"); \ No newline at end of file diff --git a/viewthread.php b/viewthread.php index 64750a5..e1961fc 100644 --- a/viewthread.php +++ b/viewthread.php @@ -31,6 +31,32 @@ if (!isset($_GET['id']) || !filter_var($_GET['id'], FILTER_VALIDATE_INT)) { created by = $current->author->name; ?> in = $current->category->name; ?> 3 days ago +get_by_id($_SESSION['user_id'], $dbc); + + if ($user->level > 0) { + echo ' +
+ '; + } +} +?>