summaryrefslogtreecommitdiff
path: root/src/web/_controller/error.php
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-12-23 11:13:27 -0500
committerFreya Murphy <freya@freyacat.org>2024-12-23 11:13:27 -0500
commit5a2ba9c2e7605bb788bc406184547d22c6436867 (patch)
treecbd988d534e8a8593a31d70571222443f80da0b3 /src/web/_controller/error.php
parentfix about modal (diff)
downloadxssbook2-5a2ba9c2e7605bb788bc406184547d22c6436867.tar.gz
xssbook2-5a2ba9c2e7605bb788bc406184547d22c6436867.tar.bz2
xssbook2-5a2ba9c2e7605bb788bc406184547d22c6436867.zip
v2.1.0, refactor w/ crimson
Diffstat (limited to '')
-rw-r--r--src/web/_controller/error.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/web/_controller/error.php b/src/web/_controller/error.php
new file mode 100644
index 0000000..55034ba
--- /dev/null
+++ b/src/web/_controller/error.php
@@ -0,0 +1,36 @@
+<?php /* Copyright (c) 2024 Freya Murphy */
+class Error_controller extends XSS_Controller {
+
+ private $error_model;
+
+ function __construct() {
+ parent::__construct();
+ $this->error_model = $this->load_model('error');
+ }
+
+ public function index(): void {
+ $this->code(404);
+ }
+
+ public function code($code): void {
+ parent::index();
+
+ $code = intval($code);
+ if ($code == 404 && rand(0, 100) > 95)
+ $code = 451;
+ if (!is_valid_status_code($code))
+ $code = 404;
+ $msg = status_code_msg($code);
+
+ $data = $this->error_model->get_data();
+ $data['title'] = $code;
+ $data['msg'] = $msg;
+
+ $this->view('header', $data);
+ $this->view('error/main', $data);
+ $this->view('footer', $data);
+ }
+
+}
+
+?>