Jump to content

[SOLVED] Check for a key?


DeanWhitehouse

Recommended Posts

Not sure where to post this, but it might come in handy for some people.

 

If you use a custom 404 page, etc.

 

Then here is an array containing the error message and error description.

 

<?php
if(isset($_GET['error']))
{
$error = $_GET['error'];
$error_ids = array(
400 => "Bad Request",
401 => "Authorization Required",
402 => "Unknown Error",
403 => "Forbidden",
404 => "Not Found",
405 => "Method Not Allowed",
406 => "Not Acceptable",
407 => "Proxy Authentication Required",
408 => "Request Timed Out",
409 => "Conflicting Request",
410 => "Gone",
411 => "Content Length Required",
412 => "Precondition Failed",
413 => "Request Entity Too Long",
414 => "Request URI Too Long",
415 => "Unsupported Media Type",
500 => "Internal Server Error",
501 => "Unknown Error",
502 => "Bad Gateway",
503 => "Service Unavailable",
504 => "Gateway Timeout",
505 => "HTTP Version Not Supported"
);
$error_det = array(
400 => "a syntax error in the request.",
401 => "you not having permission to access this data.",
402 => "unknown reasons.",
403 => "you not having permission to access this data or the server being unable to server the requested data.",
404 => "this document either no longer existing, or never existing on the server, or being moved or renamed.",
405 => "the method you are using to access the document not being allowed.",
406 => "this browser does not accept this document format",
407 => "this browser not beening authenticated on the required proxy server required to access the data",
408 => "the server closing the socket due to communications between you and server taking too long.",
409 => "too many requests for the same file at one time, or there is a conflict with an established software rule or, a DNS issue.",
410 => "the file not being found, but the file may be being updated and therefore should return.",
411 => "trying to send a document to the server but the server did not recieve a Content-Length specification in the header.",
412 => "a precondition setting required by you or server has not been met.",
413 => "the process being too large to process.",
414 => "the URL requested being too long.",
415 => "the server not supporting the type of media you are requesting.",
500 => "the server encountered a problem, most likely caused by a script.",
501 => "unknown reasons.",
502 => "the document being requested resides on a 3rd party server and our server received an error from the 3rd party server.",
503 => "the server being overloaded or down for maintenance.",
504 => "connectivity issues.",
505 => "our server not supporting the HTTP version used by this browser."
);
if(array_key_exists($type,$error_ids))
       echo $error_ids[$error]." - ".$error_det[$error];
}
?>

 

;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.