Sorry, Evidently the document you were looking for has either been moved or no longer exists. Please use the navigational links below to locate additional resources and information.
# 404.php, 8/10/2000.
# Traps 404 errors and mails a notice to the webmaster.
# Requires PHP 3.0 or newer, and mail capability on your system.
#
# Copyright 2000 shaun@shat.net under the GNU Public License.
# Disclaimer: I wrote this script for me, and it works for me.
# If it doesn't work for you, or makes your server explode,
# that's life. Please email with questions or bug reports.
# Set these variables to configure the script:
# Set $domain to your domain name (no www)
$domain = "carey.id.au";
/*
while (list($var,$value) = each ($_SERVER)) {
echo "$var => $value
";
}
phpinfo();
*/
# Set $docroot to the URL of the directory which contains your
# .htaccess file. Don't include trailing slash.
$docroot = "http://carey.id.au";
$docroot .= $_SERVER["REDIRECT_URL"];
$a = $_SERVER['HTTP_HOST'];
$c = $_SERVER['REDIRECT_URL'];
# Font face you'd like to use on the 404 page
$fontface = "Verdana";
# Font size you'd like to use on the 404 page
$fontsize = "2";
# Background color of the 404 page (default is white)
$bgcolor = "#ffffff";
# Text color you'd like to use on the 404 page (default is black)
$textcolor = "#000000";
# This script is capable of mailing the details of each 404 error
# to the webmaster. Use the $reportlevel variable to control when
# you receive these reports.
#
# 0 = don't use the email capabilities at all
# 1 = send email only if the error's referer contains your domain name
# (i.e. the 404 was generated by a broken link on your site)
# 2 = send email any time a 404 error is generated (useful for tracking
# broken links at other sites which link to you)
$reportlevel = 2;
# Set $emailaddress to the email address of whoever should be
# notified of 404 errors. Don't escape the @ symbol. This will also
# be used as the "from" address on any emails the script generates.
# You can leave this unassigned if you're not using email features.
$emailaddress = "404@carey.id.au";
################################################################
# DON'T EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING #
################################################################
# If you want to edit the script, I've commented profusely :) #
################################################################
# The send_email function sends the details of the 404 error to the
# webmaster.
function send_email()
{
# Request access to the global variables we need
global $REQUEST_URI, $HTTP_REFERER, $emailaddress, $REMOTE_ADDR, $docroot;
# Build the $errortime variable to contain the date/time of the error.
# Using date() likely would have been better, but I already had this code
# elsewhere, and I'm lazy.
$today = getdate();
$month = $today[mon];
$mday = $today[mday];
$year = $today[year];
$hours = $today[hours];
$minutes = $today[minutes];
$errortime = "$month/$mday/$year at $hours:$minutes";
# Create the body of the email message
$ip = $_SERVER['REMOTE_ADDR'];
$message .= "404 Error Report\n\nA 404 error was encountered by $ip";
$docroot = "http://carey.id.au";
$docroot .= $_SERVER["REDIRECT_URL"];
$message .= " on $errortime.\n\n";
$message .= "The URI which generated the error is: \n $docroot\n\n";
# Send the mail message. This assumes mail() will work on your system!
/*
mail("$emailaddress", "404 Error Report", $message, "From: $emailaddress");
*/
return;
}
# Done with function declarations. Main function begins here.
# Send a 404 error to the user's browser
?>
Sorry, Evidently the document you were looking for has either been moved or no longer exists. Please use the navigational links below to locate additional resources and information.