0) { header("Location: http://".$_SERVER['HTTP_HOST']); die(); } else { $errortime = (date("d M Y h:m:s")); $message = $errorNum." Error Report\r\n\r\nA ".$errorNum." error was encountered by ".$_SERVER['REMOTE_ADDR']; $message .= " on $errortime.\r\n\r\n"; $message .= "The URI which generated the error is: \nhttp://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\r\n\r\n"; $message .= "The referring page was:\n".$_SERVER['HTTP_REFERER']."\r\n\r\n"; $message .= "The used client was:\n".$_SERVER['HTTP_USER_AGENT']."\r\n\r\n"; $headers = "From: ".$emailaddress."\nDate: ".$errortime." +0100\n"; $subject = "Error: ".$errorNum." from ".$_SERVER['HTTP_REFERER']; mail($emailaddress, $subject, $message, $headers); } } else { // at last check if there are already some bad IP Addresses $bad_ref = file ($filename); $very_bad_counter = 0; foreach ($bad_ref as $val) { if (substr($_SERVER['REMOTE_ADDR'], 0, 10) == substr($val, 0, 10)) { $very_bad_counter++; } } if ($very_bad_counter > 0) { header("Location: http://www.google.com"); // or some other nice URL die(); } } // place here the html code you want to show the visitor, like echo "
Some error...
"; ?>