does anyone know of a way to record every ip address that visits my page to a file in my directory?
Printable View
does anyone know of a way to record every ip address that visits my page to a file in my directory?
There is probably a CGI scripts for that, just search around on google or something
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 :)
If your site is written in PHP, the IP address is $REMOTE_ADDR, which you could log to a file or a MySQL database.
For CGI: (note that log.txt must exist)
something like that. If your server is SSI enabled, then you can it with exec cgi. Else, you can use an image tag: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);
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";