sstangle73 Posted August 6, 2008 Share Posted August 6, 2008 i am tring to get 404 page data emailed to me. my .htaccess is ErrorDocument 404 /404.php i would like to have this in the root folder above the individual domains but thats not as important as getting the 404 page right. the 404.php page is <html> <head> <title>Error!</title> </head> <body bgcolor="#000000"> <div style="color: #FFFFFF;"> Sorry, the page you tried to visit is not valid. This error has been reported. Any further questions can be directed to <a href="mailto:[email protected]?subject=404 Not Found">Steven Stangle</a>, WebMaster, ServerMaster. </div> <?php $from_header = "From: [email protected]\r\n"; $to = "[email protected]"; $subject = "404 Error"; $today = date("D M j Y g:i:s a T"); $ip = getenv ("REMOTE_ADDR"); $requri = $PHP_SELF; $servname = getenv ("SERVER_NAME"); $pageload = $ip . " tried to load http://" . $servname . $requri ; $httpagent = getenv ("HTTP_USER_AGENT"); $httpref = getenv ("HTTP_REFERER"); $message = "$today \n\n$pageload \n\nUser Agent = $httpagent \n\n$httpref "; mail($to, $subject, $message, $from_header); ?> </body> </html> some times the emails come correct like this: Tue Aug 5 2008 9:58:58 pm EDT 67.240.55.105 tried to load http://shenentahasoccer.org/404.php User Agent = Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1 http://www.shenentahasoccer.org/staff.html but most times the last line . . .where the error was found is omitted. thanks Link to comment https://forums.phpfreaks.com/topic/118422-404-page/ Share on other sites More sharing options...
sstangle73 Posted August 6, 2008 Author Share Posted August 6, 2008 bumpercars! Link to comment https://forums.phpfreaks.com/topic/118422-404-page/#findComment-610207 Share on other sites More sharing options...
DarkWater Posted August 6, 2008 Share Posted August 6, 2008 Not all browsers properly set the HTTP referrer. Not much you can do about it other than store, on each page, the name of the page in a session variable. Link to comment https://forums.phpfreaks.com/topic/118422-404-page/#findComment-610208 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.