From 1f2af6eac6b35936f7b8edad44ca5d01482192d1 Mon Sep 17 00:00:00 2001 From: Salt <rehashedsalt@cock.li> Date: Sat, 22 Aug 2020 20:45:17 -0500 Subject: [PATCH] Add error messages --- .htaccess | 9 +++++++++ errors/400.php | 20 ++++++++++++++++++++ errors/401.php | 20 ++++++++++++++++++++ errors/403.php | 20 ++++++++++++++++++++ errors/404.php | 20 ++++++++++++++++++++ errors/410.php | 18 ++++++++++++++++++ errors/414.php | 20 ++++++++++++++++++++ errors/500.php | 19 +++++++++++++++++++ errors/styles/styles.css | 17 +++++++++++++++++ 9 files changed, 163 insertions(+) create mode 100644 errors/400.php create mode 100644 errors/401.php create mode 100644 errors/403.php create mode 100644 errors/404.php create mode 100644 errors/410.php create mode 100644 errors/414.php create mode 100644 errors/500.php create mode 100644 errors/styles/styles.css diff --git a/.htaccess b/.htaccess index 0d6ab12..45b0fbf 100644 --- a/.htaccess +++ b/.htaccess @@ -1,3 +1,12 @@ +# vim:ft=apache: +ErrorDocument 400 /errors/400.php +ErrorDocument 401 /errors/401.php +ErrorDocument 403 /errors/403.php +ErrorDocument 404 /errors/404.php +ErrorDocument 410 /errors/410.php +ErrorDocument 414 /errors/414.php +ErrorDocument 500 /errors/500.php + RedirectMatch 404 /\.git RedirectMatch 404 /\.templates RedirectMatch 404 /src diff --git a/errors/400.php b/errors/400.php new file mode 100644 index 0000000..7c58336 --- /dev/null +++ b/errors/400.php @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> + <head> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-meta.php';?> + <link href="/errors/styles/styles.css" type="text/css" rel="stylesheet" /> + <title>400 Bad Request</title> + </head> + <body> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-header.php';?> + <div class="content"> + <div class="section"> + <h1>?w?</h1> + <h2>400</h2> + <p>You done fucked up, Aaron</p> + <p>Your browser sent an invalid request. Try again. If this keeps happening, contact the site administrator.</p> + </div> + </div> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-footer.php';?> + </body> +</html> diff --git a/errors/401.php b/errors/401.php new file mode 100644 index 0000000..85c74c0 --- /dev/null +++ b/errors/401.php @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> + <head> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-meta.php';?> + <link href="/errors/styles/styles.css" type="text/css" rel="stylesheet" /> + <title>401 Unauthorized</title> + </head> + <body> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-header.php';?> + <div class="content"> + <div class="section"> + <h1>~w~</h1> + <h2>401</h2> + <p>You're not authorized to access this resource.</p> + <p>If you think this is in error, contact the site administrator.</p> + </div> + </div> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-footer.php';?> + </body> +</html> diff --git a/errors/403.php b/errors/403.php new file mode 100644 index 0000000..74e37ed --- /dev/null +++ b/errors/403.php @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> + <head> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-meta.php';?> + <link href="/errors/styles/styles.css" type="text/css" rel="stylesheet" /> + <title>403 Forbidden</title> + </head> + <body> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-header.php';?> + <div class="content"> + <div class="section"> + <h1>>w<</h1> + <h2>403</h2> + <p>You don't have permission to access this resource.</p> + <p>If you think this is in error, contact the site administrator.</p> + </div> + </div> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-footer.php';?> + </body> +</html> diff --git a/errors/404.php b/errors/404.php new file mode 100644 index 0000000..973089b --- /dev/null +++ b/errors/404.php @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> + <head> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-meta.php';?> + <link href="/errors/styles/styles.css" type="text/css" rel="stylesheet" /> + <title>404 Not Found</title> + </head> + <body> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-header.php';?> + <div class="content"> + <div class="section"> + <h1>ewe</h1> + <h2>404</h2> + <p>Yeah, we couldn't find that one. Sorry.</p> + <p>Try your request again and, if it keeps happening, contact the site administrator.</p> + </div> + </div> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-footer.php';?> + </body> +</html> diff --git a/errors/410.php b/errors/410.php new file mode 100644 index 0000000..3423cf3 --- /dev/null +++ b/errors/410.php @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> + <head> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-meta.php';?> + <link href="/errors/styles/styles.css" type="text/css" rel="stylesheet" /> + <title>410 Gone</title> + </head> + <body> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-header.php';?> + <div class="content"> + <div class="section"> + <h1>...</h1> + <p>Whatever's here isn't anymore.</p> + </div> + </div> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-footer.php';?> + </body> +</html> diff --git a/errors/414.php b/errors/414.php new file mode 100644 index 0000000..742f767 --- /dev/null +++ b/errors/414.php @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> + <head> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-meta.php';?> + <link href="/errors/styles/styles.css" type="text/css" rel="stylesheet" /> + <title>414 URI Too Long</title> + </head> + <body> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-header.php';?> + <div class="content"> + <div class="section"> + <h1>owoooooooooooooooooooo</h1> + <h2>414</h2> + <p>The request you sent had a URI that was waaaaayy too long.</p> + <p>I mean just look at the URL in your URL bar. It's huge.</p> + </div> + </div> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-footer.php';?> + </body> +</html> diff --git a/errors/500.php b/errors/500.php new file mode 100644 index 0000000..f089faa --- /dev/null +++ b/errors/500.php @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> + <head> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-meta.php';?> + <link href="/errors/styles/styles.css" type="text/css" rel="stylesheet" /> + <title>500 Internal Server Error</title> + </head> + <body> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-header.php';?> + <div class="content"> + <div class="section"> + <h1>@w@</h1> + <h2>500</h2> + <p>Something bad happened. Contact the site administrator and mention the error "500", the URL you tried to access, and the time it happened.</p> + </div> + </div> + <?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-footer.php';?> + </body> +</html> diff --git a/errors/styles/styles.css b/errors/styles/styles.css new file mode 100644 index 0000000..4da5a91 --- /dev/null +++ b/errors/styles/styles.css @@ -0,0 +1,17 @@ +/* + * styles.css + * Copyright (C) 2020 Vintage Salt + * + * Distributed under terms of the MIT license. + */ + +/* GLOBALS */ +.content { + text-align: center; +} +.content h1 { + font-size: 1000%; + margin: 0; + overflow: hidden; +} +