From d4a657334d4100c29a700d21e05b5e7fef8fce64 Mon Sep 17 00:00:00 2001 From: cflip <36554078+cflip@users.noreply.github.com> Date: Thu, 25 Mar 2021 19:57:42 -0600 Subject: Create 404 page for invalid ids --- thread.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'thread.php') diff --git a/thread.php b/thread.php index 0d516da..f784e40 100644 --- a/thread.php +++ b/thread.php @@ -7,8 +7,16 @@ session_start(); $current = new Thread(); if (!isset($_GET['id']) || !filter_var($_GET['id'], FILTER_VALIDATE_INT)) { + http_response_code(404); + include_once 'templates/404.php'; + die(); } else { - $current->get_from_database($_GET['id'], $dbc); + $result = $current->get_from_database($_GET['id'], $dbc); + if ($result == 0) { + http_response_code(404); + include_once 'templates/404.php'; + die(); + } } ?> -- cgit v1.2.3