<?
//Error Class
class error_report {
//Predefined Variables
public $link = 'http://knoxius.com/';
//Redirect
public function redirect($sub) {
ob_start();
header('Location: '.$link.$sub);
ob_end_flush();
exit;
}
//Error Codes
public $codes_400 = array('400','401','402','403','404','405','406','407','408','409','410','411','412','413','414','415');
public $codes_500 = array('500','501','502','503','504','505');
//Error
public function error($code) {
$code = intval($code);
if(empty($code)) {
$this->redirect('error/404');
} else if(!in_array($code,$this->codes_400) && !in_array($code,$this->codes_500)) {
$this->redirect('error/404');
} else {
return true;
}
}
//Error Descriptions
public function return_desc($code) {
$error_desc = array();
$error_desc[400] = 'Bad Request';
$error_desc[401] = 'Unauthorized';
$error_desc[402] = 'Payment Required';
$error_desc[403] = 'Forbidden';
$error_desc[404] = 'Not Found';
$error_desc[405] = 'Method Not Allowed';
$error_desc[406] = 'Not Acceptable';
$error_desc[407] = 'Proxy Authentication Required';
$error_desc[408] = 'Request Timeout';
$error_desc[409] = 'Conflict';
$error_desc[410] = 'Gone';
$error_desc[411] = 'Length Required';
$error_desc[412] = 'Precondition Failed';
$error_desc[413] = 'Request Entity Too Large';
$error_desc[414] = 'Request-URI Too Long';
$error_desc[415] = 'Unsupported Media Type';
$error_desc[500] = 'Internal Server Error';
$error_desc[501] = 'Not Implemented';
$error_desc[502] = 'Bad Gateway';
$error_desc[503] = 'Service Unavailable';
$error_desc[504] = 'Gateway Timeout';
$error_desc[505] = 'HTTP Version Not Supported';
return $error_desc[$code];
}
}
?>