note 37878 deleted from function.header by irchtml

From: Date: Sat, 28 Feb 2004 22:38:04 +0000
Subject: note 37878 deleted from function.header by irchtml
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-65962@lists.php.net to get a copy of this message
Note Submitter: dasa@dowling.edu ---- This is a IIS specific version of http://shat.net/php/404/ - The variables mentioned in that script had to be slightly modified to work with IIS. The script traps 404 "page not found" errors and allows the site to notify webmasters, and present a graceful exit to the user $resource = str_replace("404;", "", $_SERVER['QUERY_STRING']); if (isset($_SERVER['HTTP_REFERER'])) { $from = $_SERVER['HTTP_REFERER']; } else { $from = "Directly Entered"; } $errortime = (date("d M Y h:m:s")); $message = ""; $message .= "404 Error Report\n\nA 404 error was encountered by " .$_SERVER['REMOTE_ADDR']; $message .= "\n\n on $errortime\n"; $message .= "The URI which generated the error is: \n" . $resource ."\n\n"; $message .= "The referring page was:\n" .$from ."\n\n"; $headers = "From: auser@yourcompany.com\nDate: $errortime \n"; $subject = "404 Error: " . $resource; mail("user@yourdomain", $subject, $message, $headers); echo "<div class=\"title\">Requested Page Not Found</div>"; echo "<p>The page you requested, <b>"; echo $resource. ",</b> doesn't exist on this server. "; echo "The details of this error have automatically been mailed to the webmaster. We apologize for the inconvenience, and offer you the following choices for your consideration:</p><ul class=\"list\">"; echo "<li> <a href=\"/\">Visit our Homepage</a><br>&nbsp;<br></li>"; echo "<li> <a href=\"/forms/contact.asp?ID=website\">Ask us a Question</a><br>&nbsp;<br></li>"; echo "<li> <a href=\"javascript:history.back(1)\">Return to the linking page</a><br>&nbsp;<br></li>";

« previous php.notes (#65962) next »