From 9a4ce5d03bf529264bf26672d0e6215164a0d0cf Mon Sep 17 00:00:00 2001 From: Thedro Neely Date: Mon, 21 Jan 2019 10:54:17 -0500 Subject: .gitignore: Ignore hot comments storage and error tester Initial preparations for automated deployment --- public/error/error.html | 225 ------------------------------------------------ 1 file changed, 225 deletions(-) delete mode 100644 public/error/error.html (limited to 'public') diff --git a/public/error/error.html b/public/error/error.html deleted file mode 100644 index 14467d7..0000000 --- a/public/error/error.html +++ /dev/null @@ -1,225 +0,0 @@ - - * - * @copyright Copyright 2018, Thedro Neely. - * @license https://github.com/tdro - * @link https://github.com/tdro - */ - -declare(strict_types=1); - -$path = $_SERVER['DOCUMENT_ROOT']; -$errorJsonFile = $path . '/error/error.json'; -$errorFile = $path . '/error/error.html'; -$debug = true; - -$errorList = [ - 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, - 410, 411, 412, 413, 414, 415, 416, 417, 418, 421, - 422, 423, 424, 426, 428, 429, 431, 451, 500, 501, - 502, 503, 504, 505, 511, 520, 522, 524 -]; - -$parameters = [ - 'HttpResponseCode' => (int) $errorList[0], - 'Run' => (int) 1, -]; - -/** - * Functions - */ - -function read($file) { - return json_decode(file_get_contents($file), true); -} - -function write($file, $json) { - file_put_contents($file, json_encode($json), 0); -} - -function debug ($message, $debug) { - if ($debug) { - echo '
' . $message . '
'; - } -} - -/** - * Inline CSS styling - */ - -echo ' - -'; - -/** - * Forms - */ - -if (isset($_POST["stop"])) { - $parameters['Run'] = 0; -} - -if (isset($_POST["start"])) { - $parameters['Run'] = 1; -} - -if ($parameters['Run'] === 1) { - echo ' -
- -
- - - '; -} - -if ($parameters['Run'] === 0) { - echo ' -
- -
- -
- -
- -
- -
- - - - - '; -} - -/** - * Json File - */ - -if (!file_exists($errorJsonFile)) { - - debug('Socket file does not exist. Creating...', $debug); - write($errorJsonFile, $parameters); - - if (!file_exists($errorJsonFile)) { - debug('Socket file creation failed!', $debug); - return; - } -} - -/** - * Error Code and Array Keys - */ - -$getError = read($errorJsonFile)['HttpResponseCode']; -debug('Current Error Code: ' . $getError . '
', $debug); - -$currentErrorKey = array_search($getError, $errorList); -$nextErrorKey = $currentErrorKey + 1; - -$getErrorTotal = count($errorList) - 1; -debug('Error List Count: ' . ($currentErrorKey + 1) . '/' . ($getErrorTotal + 1), $debug); - -/** - * Error Run - */ - -if ($nextErrorKey <= $getErrorTotal) { - - if ($parameters['Run'] === 1) { - echo ''; - } - - foreach ($parameters as $parameter) { - $parameters['HttpResponseCode'] = $errorList[$nextErrorKey]; - } - - write($errorJsonFile, $parameters); - var_dump(read($errorJsonFile)); - var_dump($_POST); - - /** - * Send HTTP response code - */ - - http_response_code((int) $getError); - return; - -} - -write($errorJsonFile, $parameters); -debug('Error run completed.', $debug); -var_dump($parameters); - -/** - * Http Response Template Files - */ - -$http_response_status = [ - 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 => "Payload Too Large", - 414 => "Requested URI Too Long", - 415 => "Unsupported Media Type", - 416 => "Requested Range Not Satisfiable", - 417 => "Expectation Failed", - 418 => "I'm a teapot", - 421 => "Misdirected Request", - 422 => "Unprocessable Entity", - 423 => "Locked", - 424 => "Failed Dependency", - 426 => "Upgrade Required", - 428 => "Precondition Required", - 429 => "Too Many Requests", - 431 => "Request Header Fields Too Large", - 444 => "Connection Closed Without Response", - 451 => "Unavailable For Legal Reasons", - 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", - 508 => "Loop Detected", - 510 => "Not Extended", - 511 => "Network Authentication Required", -]; - -// var_dump($http_response_status); -// echo key($http_response_status); - -?> -- cgit v1.2.3