diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-06-13 21:20:52 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-06-13 21:20:52 +0000 |
commit | 7d631fb606b816c8bfefb448a5708e44e8c0e932 (patch) | |
tree | e134a26439021168d685a72ea11e2e508ae3e71a /error.php | |
parent | 67cfb7808fda46dc3da4724317173b5a32d3d784 (diff) | |
download | brdo-7d631fb606b816c8bfefb448a5708e44e8c0e932.tar.gz brdo-7d631fb606b816c8bfefb448a5708e44e8c0e932.tar.bz2 |
- Simplified error handling such as 404 errors.
Diffstat (limited to 'error.php')
-rw-r--r-- | error.php | 51 |
1 files changed, 8 insertions, 43 deletions
@@ -1,50 +1,15 @@ <?php -function error_throttle() { - print "WARNING: submission rate exceeded. We detected too much data or events from your IP. Please wait a few minutes and try again. If you believe this is not justified, please contact us at <A HREF=\"mailto:". variable_get(site_mail, "root@localhost") ."\">". variable_get(site_mail, "root@localhost") ."</A>."; -} - -function error_httpd() { - global $REDIRECT_STATUS, $REDIRECT_URL, $HTTP_REFERER, $HTTP_USER_AGENT; - - switch($REDIRECT_STATUS) { - case 500: - $message = "500 error - internal server error"; - break; - case 404: - $message = "404 error - `$REDIRECT_URL' not found"; - break; - case 403: - $message = "403 error - access denied - forbidden"; - break; - case 401: - $message = "401 error - authorization required"; - break; - case 400: - $message = "400 error - bad request"; - break; - default: - $message = "unknown error"; - } - - watchdog("error", "message: `$message' - requested url: $REDIRECT_URL - referring url: $HTTP_REFERER - user agent: $HTTP_USER_AGENT"); +include_once "includes/common.inc"; - print "<PRE>\n"; - print "<H1>Oops, an error occured!</H1>\n"; - print "<B>Processed output:</B><BR>\n"; - print " * $message<BR>\n"; - print " * Return to the <A HREF=\"index.php\">main page</A>.\n"; - print "</PRE>\n"; -} +$errors = array(500 => "500 error - internal server error", + 404 => "404 error - `$REDIRECT_URL' not found", + 403 => "403 error - access denied - forbidden", + 401 => "401 error - authorization required", + 400 => "400 error - bad request"); -include_once "includes/common.inc"; +watchdog("error", $errors[$REDIRECT_STATUS]); -switch ($op) { - case "throttle": - error_throttle(); - break; - default: - error_httpd(); -} +header("Location: index.php"); ?>
\ No newline at end of file |