diff options
author | cflip <36554078+cflip@users.noreply.github.com> | 2021-03-25 19:57:42 -0600 |
---|---|---|
committer | cflip <36554078+cflip@users.noreply.github.com> | 2021-03-25 19:57:42 -0600 |
commit | d4a657334d4100c29a700d21e05b5e7fef8fce64 (patch) | |
tree | 031508ff1ab34820dceceb7ae2a7e772db6fbf5e /category.php | |
parent | 0ecae4e72d7d4ace51b731ff2c5d5eb63351e3e1 (diff) |
Create 404 page for invalid ids
Diffstat (limited to 'category.php')
-rw-r--r-- | category.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/category.php b/category.php index ad4faa6..b149237 100644 --- a/category.php +++ b/category.php @@ -7,8 +7,16 @@ session_start(); $current = new Category(); 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(); + } } ?> <!DOCTYPE html> |