...

IP tracking

malcom
10-12-2002, 01:49 PM
Hi,

Maybe not a good place to ask but can anyone help me with a simple but good working script that's display's the ip adres of a visitor to a site, the scripts i found don't seem to work, most my visitor's use IE 5.0 and above.

Thanks

Fataqui
10-13-2002, 08:34 AM
Hi


what you are asking is very easy to do!

ip.pl.......



#!/usr/local/bin/perl -w


print "Content-type: text/html\n\n";


$ip = "$ENV{'REMOTE_ADDR'}";


print "Your IP: $ip";


# log it maybe.....

$found = 0;
open (DATA, "log.txt");
while(<DATA>) {
$line = $_;
chop $line;
if ($line =~ m/^($ip)$/) {
$found = 1;
last;
}
}

if (!$found) {
open (DATA, ">>log.txt");
flock(DATA, 2);
print DATA "$ip\n";
close (DATA);
}
exit(0);

# end script





F!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum