[thelist] 404 logging script change needed to add an IP lookup output
John C Bullas
jcbullas at nildram.co.uk
Fri Mar 26 01:38:21 CST 2004
Hi,
I have posted this question on a couple of occasions and despite replies
saying it was easy no one seemed able/happy
to assist this poor geologist in revising it....
THUS..... In return for an "EBeer" via paypal would anyone be willing to
amend and post me a version of this 404 alerting php script
that will as well as referring Ip etc etc give me a IP lookup result as
part of the email, so I can see
212.77.1.247 is actually vatican.va etc etc
Regards
FB
(NB: the use of the word "see" was accidental BTW, it was not the holy see)
==============================
<?php
$ip = getenv ("REMOTE_ADDR");
$requri = getenv ("REQUEST_URI");
$servname = getenv ("SERVER_NAME");
$combine = $ip . " tried to load " . $servname . $requri ;
$httpref = getenv ("HTTP_REFERER");
$httpagent = getenv ("HTTP_USER_AGENT");
$today = date("D M j Y g:i:s a T");
$message = " The somwhere.something.UK 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 = "webmaster at somewhere.org";
$subject = "404 recorded at www.somewhere.com";
$from = "From:mailserver at wherever.co.uk\r\n";
mail($to, $subject, $message2, $from);
echo $message;
?>
More information about the thelist
mailing list