diff --git a/pages/projects.php b/pages/projects.php index db09297..5823716 100644 --- a/pages/projects.php +++ b/pages/projects.php @@ -1,5 +1,6 @@ ['code' => 403, 'title' => 'Access Denied'], - 404 => ['code' => 404, 'title' => 'Not Found'], - 405 => ['code' => 405, 'title' => 'Method Not Supported'], + 403 => [ + 'code' => 403, + 'title' => 'Access Denied', + 'image' => '/assets/errors/403.jpg', + 'desc' => 'You are not supposed to be here.', + ], + 404 => [ + 'code' => 404, + 'title' => 'Not Found', + 'image' => '/assets/errors/404.jpg', + 'desc' => 'Whatever you\'re looking for is no longer here, or might not have been here in the first place.', + ], + 405 => [ + 'code' => 405, + 'title' => 'Method Not Supported', + 'image' => '/assets/errors/405.jpg', + 'desc' => 'You\'re up to something, aren\'t you?', + ], ]); function fm_component(string $name, array $vars = []) { @@ -115,7 +130,7 @@ $reqMethod = filter_input(INPUT_SERVER, 'REQUEST_METHOD', F $reqPath = '/' . trim(parse_url(filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_STRING), PHP_URL_PATH), '/'); if(substr($reqPath, 0, 7) === '/error/') { - $statusCode = intval(substr($reqPath, 8, 3)); + $statusCode = intval(substr($reqPath, 7, 3)); } else { foreach(glob(__DIR__ . '/../pages/*.php') as $page) { $result = include_once $page; @@ -132,6 +147,13 @@ if(substr($reqPath, 0, 7) === '/error/') { $errorInfo = FM_ERRS[$statusCode ?? 404] ?? FM_ERRS[404]; http_response_code($errorInfo['code']); + fm_component('header', ['title' => $errorInfo['title']]); -printf("

%s

\r\n", $errorInfo['title']); +?> +
+

+ <?=$errorInfo['image'];?> +
+
+