[thelist] Error reporting to our site........ using PHP?
John C Bullas
jcbullas at nildram.co.uk
Mon Jan 5 21:00:27 CST 2004
At 00:20 06/01/2004, you wrote
>Michele Foster wrote:
>
> > It's not to find 404's on *our* site .. it's to find sites that
> > are linking to us with incorrect links.
can you run PHP in a custom 404 page?
set up a custom 404 page with this embedded in it, it will email you the
referring URL
(the web address with the bad link) [if any] and the page they were trying
to find :)
HOWEVER you will then pick up evidence of all the stupid webbots as they
nose around
but still worth it to find bad links.......
FB
<?php
$ip = getenv ("REMOTE_ADDR");
$requri = getenv ("REQUEST_URI");
$servname = getenv ("SERVER_NAME");
$combine = $ip . " tried to open " . $servname . $requri ;
$httpref = getenv ("HTTP_REFERER");
$httpagent = getenv ("HTTP_USER_AGENT");
$today = date("D M j Y g:i:s a T");
$message = "The Webmaster has been informed that:<br>On $today, \n
$combine <br> \n
User Agent = $httpagent <br>\n
$note\n
Referring URL (if any) : $httpref";
$note = "Referring URL:" ;
$message2 = "$today \n
$combine \n
User Agent = $httpagent \n
$note \n
$httpref ";
$to = "somewhere at yourdomain.org";
$subject = "404 recorded at Yourdomain.com";
$from = "From: a_useful_emailaddress at somewhereyouchoose.com\r\n";
mail($to, $subject, $message2, $from);
echo $message;
?>
More information about the thelist
mailing list