Go Back   CodingForums.com > :: Server side development > Perl/ CGI

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-12-2002, 01:49 PM   PM User | #1
malcom
New to the CF scene

 
Join Date: Oct 2002
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
malcom is an unknown quantity at this point
IP tracking

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
malcom is offline   Reply With Quote
Old 10-13-2002, 08:34 AM   PM User | #2
Fataqui
New to the CF scene

 
Join Date: Oct 2002
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Fataqui is an unknown quantity at this point
Hi


what you are asking is very easy to do!

ip.pl.......

PHP Code:

#!/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(DATA2);
print 
DATA "$ip\n";
close (DATA);
}
exit(
0);

# end script 


F!
Fataqui is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:32 AM.


Advertisement
Log in to turn off these ads.