[thelist] modification to PHP 404 notification script.... anyone?

Ralph Guzman ralph213 at sbcglobal.net
Thu Jan 15 16:53:06 CST 2004

If you have the users ip stored in $ip 

$ip = getenv ("REMOTE_ADDR");

Then, use the gethostbyaddr() function to get the domain name for a given IP

$domainname = gethostbyaddr($ip]);

-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of John C Bullas
Sent: Wednesday, January 14, 2004 10:23 AM
To: thelist at lists.evolt.org
Subject: [thelist] modification to PHP 404 notification script.... anyone?

Colleagues, owing to a bounced email I lost touch with the lister who knew 
the PHP commands to
return the domain from an IP (WHOIS basically) into the script below......

Below is the php script I use (I munged the addresses) and I wonder if 
he/she might adapt it
and post me the undated version

Sorry to clutter the list but archives for detective work on "thelist" seem 
difficult to find....


=================== 404 notifier script ========


$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 = " John Bullas has been informed that:<br>On $today,  \n
$combine <br> \n
User Agent = $httpagent <br>\n
Referring URL (if any) : $httpref";

$note = "Referring URL:" ;

$message2 = "$today \n
$combine \n
User Agent = $httpagent \n
$note \n
$httpref ";

$to = "johnB at lalalalal.com";
$subject = "404 recorded at www.soton.la.la/lalalal/";
$from = "From: webserver at soton.la.alalal\r\n";

mail($to, $subject, $message2, $from);

echo $message;

* * Please support the community that supports you.  * *

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 

More information about the thelist mailing list