note 37878 added to function.header

From: Date: Mon, 01 Dec 2003 03:13:09 +0000
Subject: note 37878 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-61187@lists.php.net to get a copy of this message
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>"; ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37878 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37878&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37878&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#61187) next »