I've a 404 error page configured to send me an email when a page is not found. However I was expecting the page the user typed in to be displayed in the email, so I could verify if this is a valid page or not. E.G. User types in www.domain.com/xrz.html so in the email it tells me the domain typed was www.domain.com/xrz.html, but the code just tells me www.domain.com/404.html my code is: <?php $count = 0; // don't send mail if we don't know the referring page // it's probably a searchengine or infected windows system requesting known NT server exploits // may reinstate but wana know if works //if ($HTTP_REFERER == "") //{ //$count++; //} // debug comment, you can remove this line if you want: echo "<!-- count: $count -->\n"; if ($count == 0) { $today = date("j F Y, G:i:s"); $message = "Date and Time: $today\nRequest URL: http://$SERVER_NAME$REQUEST_URI\nReferring page: $HTTP_REFERER\n\nClient: $HTTP_USER_AGENT\nRemote IP: $REMOTE_ADDR\n\n"; $message .= "This is an automated message.\n\nIan."; mail("email@domain.com", "Error 404", $message, "From: email@domain.com\nReply-To: email@domain.com"); } ?> PHP: This is my .htaccess file: ErrorDocument 404 http://www.domain.com/404.html AddType application/x-httpd-php .php .htm .html Thanks for any pointers. Ian
15. $message = "Date and Time: $today\nRequest URL: http://$SERVER_NAME$REQUEST_URI\nReferring page: $HTTP_REFERER\n\nClient: $HTTP_USER_AGENT\nRemote IP: $REMOTE_ADDR\n\n"; Use $_SERVER['HTTP_REFERER'] instead of $HTTP_REFERER, the same goes for the rest of the variables on line 15