File: error/server_error.php

Recommend this page to a friend!
  Classes of Francisco Nez  >  BEH Basic PHP Error Handler Class  >  error/server_error.php  >  Download  
File: error/server_error.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: BEH Basic PHP Error Handler Class
Handle PHP errors displaying them using templates
Author: By
Last change:
Date: 10 months ago
Size: 1,402 bytes
 

Contents

Class file image Download
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/error/conf_error.php';
$error_text = 'Unknown Error';
$code = $_SERVER['REDIRECT_STATUS'];
$codes = [
   
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 => 'URI Too Long',
   
415 => 'Unsupported Media Type',
   
500 => 'Internal Server Error',
   
501 => 'Not Implemented',
   
502 => 'Bad Gateway',
   
503 => 'Service Unavailable',
   
504 => 'Gateway Timeout',
   
505 => 'HTTP Version Not Supported',
];
$source_url = 'http' . ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
if (
array_key_exists($code, $codes) && is_numeric($code)) {
   
$error_text = $codes[$code];
}

/** @var array $conf */
$error_skin = $_SERVER['DOCUMENT_ROOT'] . '/error/skin/sk_' . $conf['skin'] . '_server_error.php';
if (
file_exists($error_skin)) {
   
/** @noinspection PhpIncludeInspection */
   
require_once $error_skin;
} else {
    require_once
$_SERVER['DOCUMENT_ROOT'] . '/error/skin/sk_basic_server_error.php';
}
die;

For more information send a message to info at phpclasses dot org.