[thelist] 404 logging script change needed to add an IP lookup output

Ken Schaefer ken at adOpenStatic.com
Fri Mar 26 05:34:39 CST 2004


Look - have you considered:
a) reading a PHP manual -or- attempting to google some code
b) attempting to achieve this yourself
c) posting what you've tried, and the problems you've run into?

I don't know a great deal about PHP, but personally I've helped people
who've made a systemic, and concerted effort, to help themselves.

It seems there is a getHostByAddr() function. And there is some sample code
here that uses it:
http://shat.net/php/nqt/nqt.php.txt

And the documentation, including a simple usage sample is here:
http://au.php.net/manual/en/function.gethostbyaddr.php

And you can find more stuff here:
http://www.google.com.au/search?q=PHP+how+to+do+a+DNS+lookup

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "John C Bullas" <jcbullas at nildram.co.uk>
Subject: [thelist] 404 logging script change needed to add an IP lookup
output


: 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