error.php 1.35 KB
Newer Older
1
<?
2

Dries's avatar
Dries committed
3 4
function error_flood() {
  global $site_email;
Dries's avatar
Dries committed
5

Dries's avatar
Dries committed
6 7
  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 think this is not justified, please contact us at <A HREF=\"mailto:$site_email\">$site_email</A>.";
} 
8

Dries's avatar
Dries committed
9
function error_httpd() {
10
  global $REDIRECT_STATUS, $REDIRECT_URL, $HTTP_REFERER, $HTTP_USER_AGENT;
Dries's avatar
Dries committed
11 12 13 14 15 16

  switch($REDIRECT_STATUS) {
    case 500:
      $message = "500 error - internal server error";
      break;
    case 404:
Dries's avatar
Dries committed
17
      $message = "404 error - `$REDIRECT_URL' not found";
Dries's avatar
Dries committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31
      break;
    case 403:
      $message = "403 error - access denied - forbidden";
      break;
    case 401:
      $message = "401 error - authorization required";
      break;
    case 401:
      $message = "400 error - bad request";
      break;
    default:
      $message = "unknown error";
  }

32
  watchdog("error", "message: `$message' - requested url: $REDIRECT_URL - referring url: $HTTP_REFERER - user agent: $HTTP_USER_AGENT");
Dries's avatar
Dries committed
33 34 35 36 37 38 39 40 41
 
  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=\"\">main page</A>.\n";
  print "</PRE>\n";
}

Dries's avatar
Dries committed
42
include "includes/common.inc";
Dries's avatar
Dries committed
43 44 45 46 47 48 49 50 51 52

switch ($op) {
  case "flood":
    error_flood();    
    break;
  default:
    error_httpd();
}

?>