Q:
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.
#!/usr/bin/perl
#!/usr/local/bin/perl
$out =$ENV{"REMOTE_ADDR"} . "\n";
$checkforip=$ENV{"REMOTE_ADDR"};
$sendto="http://www.1adclick.com/contact.html";
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
ip.
I know that this is probally very simple but I have been working on this
for 12 days with no result. Please help me.
Thanks,
*NAME-DELETED* *NAME-DELETED*
daveaton@hotmail.com
A:
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.
Regards,
Peter
[ back to toc ]