PDA

Click to See Complete Forum and Search --> : record ip


BigBosky
Feb 7th, 2002, 01:10 PM
does anyone know of a way to record every ip address that visits my page to a file in my directory?

Gimlin
Feb 7th, 2002, 05:19 PM
There is probably a CGI scripts for that, just search around on google or something

zmerlinz
Feb 7th, 2002, 05:29 PM
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 :)

filburt1
Feb 27th, 2002, 04:10 PM
If your site is written in PHP, the IP address is $REMOTE_ADDR, which you could log to a file or a MySQL database.

The Hobo
Feb 27th, 2002, 05:21 PM
For CGI: (note that log.txt must exist)


$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:


'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";