On Dec 12, 2003, at 8:39 AM, Michael Sullivan wrote:


I don't know much about Perl yet. I copied a website counter script off
of htmlgoodies.com and I was wondering if it would be possible to modify
the script so that it wouldn't add to the counter if the visitor was
from my IP address. Is that possible, and if so how would I do it?
-Michael Sullivan-

assuming that your server does the right thing, and assuming that the browser does the polite thing, then the variable you are looking for that will be passed to your cgi code is the

REMOTE_ADDR

the REMOTE_HOST is less likely to be set.
So you could start with

my $rem_addr = $ENV{REMOTE_ADDR};

now you have a dot_quad - say "199.108.16.11"
now all you have to do is deal with the DNS
look up problem that IP and resolve IF it
is inside of your 'domain'.

The general recommendation then is Net::DNS
<http://search.cpan.org/~crein/Net-DNS-0.43/lib/Net/DNS.pm>



ciao
drieux

---


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to