//portions of this script are originally from shat.net //the rest was put together by jennifer of scriptygoddess.com # Set $domain to your domain name (no www) $domain = "top-blogs.com"; # Set $docroot to the URL of the directory which contains your # .htaccess file. Don't include trailing slash. $docroot = "http://www.top-blogs.com"; # Set $emailaddress to the email address of whoever should be # notified of 404 errors. Don't escape the @ symbol. $emailaddress = "leisa@netonecom.net"; //upload a BLANK TEXT FILE to your server //named "missing.txt" //CHMOD 777 on this file //enter the full server path* to this text file below $missinglist = "/usr/local/apache/www/top-blogs.com/htdocs/missing.txt"; //What I mean by full server path: //http://www.scriptygoddess.com/archives/004860.php //--------all done for customizing script------ function send_email() { //this function originally from this script: //http://shat.net/php/404/404Handler.php.txt # Copyright 2000-2002 shaun@shat.net under the GPL v2+ # 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. $errortime = (date("d M Y h:m:s")); # Create the body of the email message $message .= "404 Error Report\n\nA 404 error was encountered by $REMOTE_ADDR"; $message .= " on $errortime.\n\n"; $message .= "The URI which generated the error is: \n$docroot$REQUEST_URI\n\n"; $message .= "The referring page was:\n$HTTP_REFERER\n\n"; # Send the mail message. This assumes mail() will work on your system! $headers = "From: $emailaddress\nDate: $errortime -0600\n"; $subject = "404 Error: $docroot$REQUEST_URI"; mail($emailaddress, $subject, $message, $headers); return; } $missinglistarray = parse_ini_file($missinglist); //here's the part that opens your list of missing pages //if you run into problems writing to the file //you can uncomment the "echo" lines //to see where you're having a problem //most of this code came from here: //http://us4.php.net/manual/en/function.fwrite.php if (in_array($REQUEST_URI, $missinglistarray)) { //do nothing - it's already in the list } else { //send an email with the info send_email(); //now add new missing page to the list $currentKeyNum = str_pad(count($missinglistarray), 3, "0", STR_PAD_LEFT); $addmissing = $currentKeyNum." = \"".$REQUEST_URI."\";\n"; // Let's make sure the file exists and is writable first. if (is_writable($missinglist)) { if (!$handle = fopen($missinglist, 'a')) { //echo "Cannot open file ($missinglist)"; exit; } if (fwrite($handle, $addmissing) === FALSE) { //echo "Cannot write to file ($missinglist)"; exit; } //echo "Success, wrote ($addmissing) to file ($missinglist)"; fclose($handle); } else { //echo "The file $missinglist is not writable"; } } ?>

|
|
Top Blogs Dot ComERROR 404
Please Click Here to Return to our Home Page.
|