Skip to content

Instantly share code, notes, and snippets.

@MaverickEsq
Last active April 6, 2022 23:46
Show Gist options
  • Save MaverickEsq/aa29812c67d7483d9c852cb1a8ff52d0 to your computer and use it in GitHub Desktop.
Save MaverickEsq/aa29812c67d7483d9c852cb1a8ff52d0 to your computer and use it in GitHub Desktop.
Windows NT BSOD 404 / generic error page
<?php
$error = $_SERVER['REDIRECT_STATUS'];
$page = $_SERVER['REDIRECT_URL'];
$email = 'Your email here';
/* Alias for apache httpd conf
Alias "/error" "/var/www/html/error_page.php"
*/
/* .htaccess for / for apache
ErrorDocument 400 /error
ErrorDocument 401 /error
ErrorDocument 402 /error
ErrorDocument 403 /error
ErrorDocument 404 /error
ErrorDocument 405 /error
ErrorDocument 406 /error
ErrorDocument 407 /error
ErrorDocument 408 /error
ErrorDocument 409 /error
ErrorDocument 410 /error
ErrorDocument 411 /error
ErrorDocument 412 /error
ErrorDocument 413 /error
ErrorDocument 414 /error
ErrorDocument 415 /error
ErrorDocument 416 /error
ErrorDocument 417 /error
ErrorDocument 422 /error
ErrorDocument 423 /error
ErrorDocument 424 /error
ErrorDocument 426 /error
ErrorDocument 500 /error
ErrorDocument 501 /error
ErrorDocument 502 /error
ErrorDocument 503 /error
ErrorDocument 504 /error
ErrorDocument 505 /error
ErrorDocument 506 /error
ErrorDocument 507 /error
ErrorDocument 510 /error
*/
$http_codes = array(
100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing',
103 => 'Checkpoint',
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
204 => 'No Content',
205 => 'Reset Content',
206 => 'Partial Content',
207 => 'Multi-Status',
300 => 'Multiple Choices',
301 => 'Moved Permanently',
302 => 'Found',
303 => 'See Other',
304 => 'Not Modified',
305 => 'Use Proxy',
306 => 'Switch Proxy',
307 => 'Temporary Redirect',
400 => 'Bad Request',
401 => 'Unauthorized',
402 => 'Payment Required',
403 => 'Forbidden',
404 => 'Not Found',
405 => 'Method Not Allowed',
406 => 'Not Acceptable',
407 => 'Proxy Authentication Required',
408 => 'Request Timeout',
409 => 'Conflict',
410 => 'Gone',
411 => 'Length Required',
412 => 'Precondition Failed',
413 => 'Request Entity Too Large',
414 => 'Request-URI Too Long',
415 => 'Unsupported Media Type',
416 => 'Requested Range Not Satisfiable',
417 => 'Expectation Failed',
418 => 'I\'m a teapot',
422 => 'Unprocessable Entity',
423 => 'Locked',
424 => 'Failed Dependency',
425 => 'Unordered Collection',
426 => 'Upgrade Required',
449 => 'Retry With',
450 => 'Blocked by Windows Parental Controls',
500 => 'Internal Server Error',
501 => 'Not Implemented',
502 => 'Bad Gateway',
503 => 'Service Unavailable',
504 => 'Gateway Timeout',
505 => 'HTTP Version Not Supported',
506 => 'Variant Also Negotiates',
507 => 'Insufficient Storage',
509 => 'Bandwidth Limit Exceeded',
510 => 'Not Extended'
);
$pointers = array(
"0xDEADB3EF",
"0x00CAFE18",
"0x00C0FF33",
"0x002BDEAD",
"0x00D00D00",
"0xDA7DABD0",
"0xC001C001",
"0x0BADC0D3",
"0xC001D00D",
"0xABADBABE",
"0xB10SF00D",
"0xB16B00B5",
"0x00D15E5E",
"0xDEAD2BAD"
);
http_response_code($error);
?>
<html>
<head>
<title> <?= $error ?> - <?= $http_codes[$error] ?> </title>
<style type="text/css">
body {
background:#0000aa;
color:#ffffff;
font-family:courier;
font-size:2vh;
text-align: left;
}
blink {
color:yellow;
}
.neg {
background:#fff;
color:#0000aa;
padding:2px 8px;
font-weight:bold;
}
p {
text-align:left;
}
a,a:hover {
color:inherit;
font:inherit;
}
.menu {
text-align:left;
margin-top:50px;
}
@keyframes in {
0% {
visibility: hidden;
}
99% {
visibility: hidden;
}
100% {
visibility: visible;
}
}
#one {
animation: in 1.5s linear;
}
#two {
animation: in 3s linear;
}
#three {
animation: in 4.5s linear;
}
</style>
</head>
<body>
<div>
<p>A problem has been detected and httpd has been shut down to prevent damage <br>
to your computer.<br>
<br>
<?= $error ?>_<?= str_replace(' ', '_', strtoupper($http_codes[$error])) ?><br>
<br>
If this is the first time you've seen this http error screen,<br>
refresh your browser, If this screen appears again, follow <br>
these steps:<br>
<br>
Check to make sure any URLs or filenames are properly typed.<br>
If this is a new URL, ask your web or systems admin<br>
for any httpd updates you might need.<br>
<br>
If problems continue, disable or remove any newly installed hardware<br>
or software. Disable BIOS memory options such as caching or shadowing.<br>
If you need to use Safe Mode to remove or disable components, restart<br>
your computer, press F8 to select Advanced Startup Options, and then<br>
select Safe Mode.<br>
<br>
Technical information:<br>
<br>
*** ERROR: 0X00000<?= $error ?> (<?= $pointers[array_rand($pointers)] ?>, <?= $pointers[array_rand($pointers)] ?>)<br>
<br>
*** <?= htmlspecialchars($page) ?> - <?= $http_codes[$error] ?><br></p>
<div style="padding-top:3px;">
<div id="one">Begining dump of physical memory</div>
<div id="two">Physical memory dump complete.</div>
<div id="three">Contact your <a href="mailto:<?= preg_replace_callback('/./', function($m) { return '&#'.ord($m[0]).';'; }, $email) ?>">system administrator</a> or return to the <a href="/">index</a> for further<br>assistance<br></div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment