summaryrefslogtreecommitdiff
path: root/viewcategory.php
diff options
context:
space:
mode:
Diffstat (limited to 'viewcategory.php')
-rw-r--r--viewcategory.php17
1 files changed, 7 insertions, 10 deletions
diff --git a/viewcategory.php b/viewcategory.php
index 852148b..e68bab2 100644
--- a/viewcategory.php
+++ b/viewcategory.php
@@ -1,22 +1,19 @@
<?php
-
include_once 'includes/model/Category.php';
session_start();
-$current = new Category();
+if (!isset($_GET['id']) or !filter_var($_GET['id'], FILTER_VALIDATE_INT)) {
+ http_response_code(404);
+ include('includes/templates/404.php');
+ die();
+}
-if (!isset($_GET['id']) || !filter_var($_GET['id'], FILTER_VALIDATE_INT)) {
+$current = new Category($_GET['id']);
+if (!$current->has_value()) {
http_response_code(404);
include('includes/templates/404.php');
die();
-} else {
- $result = $current->get_from_database($_GET['id']);
- if (!$result) {
- http_response_code(404);
- include('includes/templates/404.php');
- die();
- }
}
?>
<!DOCTYPE html>