[ back to toc ]

Need help loging unique ips.

Date: 2002/05/15 10:35

I am looking to recording unique ips that follow a certain hidden link on
my website. I am using a text database with one data(the ip) per line.

Here is the actual small script that I am using.

$out =$ENV{"REMOTE_ADDR"} . "\n";

open (FILE2,">>robotips.data");
print FILE2 $out;
print "Location: $sendto\n\n";
close FILE2;

This script adds every ip but I don't
know how to make the script check to
see if it's already been added before
adding a new ip.

So my question is how can I log truley unique ips
instead of loging every ip.. Search engines can access this file 30 times
and I have the same 30 ips when I would like to only have one per unique

I know that this is probally very simple but I have been working on this
for 12 days with no result. Please help me.

You have to store the IP numbers in some database. The simplest you can
use gdb supported by Perl. See the Perl documentation how to 'tie' a hash
to a file using gdb or some other database.


[ back to toc ]