Results 1 to 5 of 5

Thread: record ip

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    medina, OH
    Posts
    125

    record ip

    does anyone know of a way to record every ip address that visits my page to a file in my directory?
    "Sometimes the only way you can feel good about yourself is by making someone else look bad And I'm tired of making other people feel good about themselves"-Homer Simpson

  2. #2
    Fanatic Member Gimlin's Avatar
    Join Date
    Dec 2001
    Location
    Hell
    Posts
    734
    There is probably a CGI scripts for that, just search around on google or something

  3. #3
    Fanatic Member zmerlinz's Avatar
    Join Date
    May 2000
    Location
    in a world where the sun always shines on the bloody tv!!
    Posts
    604
    if you are hosting your website on your own computer and you are using apache, then this will automatically log all of the ip numbers that goto your site for you

    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

    [Galahtech.com] | [My Site] | [Fishsponge] | [UnixForum.co.uk]

  4. #4
    If your site is written in PHP, the IP address is $REMOTE_ADDR, which you could log to a file or a MySQL database.

  5. #5
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    For CGI: (note that log.txt must exist)

    Code:
    $ip =  $ENV{'REMOTE_ADDR'};
    
    open (LOG,"+<log.txt");
    flock (LOG,2); seek (LOG,0,0);
    @logfile = <LOG>;
    
    push @logfile, $ip;
    seek (LOG,0,0);
    print (LOG @logfile);
    truncate (LOG,tell(LOG));
    close (LOG);
    something like that. If your server is SSI enabled, then you can it with exec cgi. Else, you can use an image tag:

    Code:
    'SSI
    <!--#exec cgi="ip.cgi"-->
    
    'image
    <img src="ip.cgi">
    
    'for image, add this line to the bottom of the cgi file:
    print "Location: http://www.site.com/yourimage.gif\n\n";
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width