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

patrick pms at stoutstreet.com
Fri Mar 26 08:56:33 CST 2004

One caveat to this: I believe the server (Apache, most likely) needs to
have hostname lookups turned on

patrick sanders
web sites that fit

Ken Schaefer wrote:

>----- Original Message ----- 
>From: "John C Bullas (soton.ac.uk relay)" <jcbullas at nildram.co.uk>
>To: <thelist at lists.evolt.org>
>Sent: Friday, March 26, 2004 10:51 PM
>Subject: Re: [thelist] 404 logging script change needed to add an IP lookup
>: At 11:34 26/03/2004, you wrote:
>: >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.
>: I will take a look at the URLs below however on first examination the
>: incorporation
>: of 120+ lines of PHP into my tiny 404 emailling script looks very daunting
>: indeed ;(
>No need to incorporate 120 lines. This bit seems the relevant bit (found by
>searching for getHostByAddr)
>function lookup($target){
>    global $ntarget;
>    $msg = "$target resolved to ";
>    if( eregi("[a-zA-Z]", $target) )
>        $ntarget = gethostbyname($target);
>    else
>        $ntarget = gethostbyaddr($target);
>    $msg .= $ntarget;
>    message($msg);
>    }
>which I believe looks at what the user submitted in the form. It what user
>submitted contains letters, then it assumes the user submited a domain name
>and  it uses getHostByName to return the IP address of the domain. Otherwise
>the user submitted and IP address, and it uses gethostByAddr() to do a DNS
>lookup on the IP address.
>Check the second link that I posted. That has a simple example.

More information about the thelist mailing list