Please, help me adjust a little statictic counter script to exclude my own IP address.
I am finding my stats a bit inflated because working on my own site generates a lot of hits from my home address.
Though this code has a terrible note not recommending to change something inside code itself, I'll risk ask help from valuable monks..
#!/usr/bin/perl
$sendmail_path='/usr/lib/sendmail';
$to_address='email@domain.com';
#DONT CHANGE ANYTHING BELOW THIS LINE
if (length($ENV{HTTP_X_FORWARDED_FOR})>1) { $xf=$ENV{HTTP_X_FORWARDED_
+FOR}; }
else { $xf='NULL'; }
$ra=$ENV{REMOTE_ADDR}; @numbs=split(/\./, $ra);
$address=pack("C4", @numbs); $gothostbyaddr=gethostbyaddr($address, 2)
+;
$gt=gmtime; $head=$ENV{REMOTE_ADDR};
@tl=(85,78,73,46,68,69); ($gothostbyaddr) && ($head=$gothostbyaddr);
if (length($ENV{QUERY_STRING})>1) { $reff=$ENV{QUERY_STRING}; } else
{$reff=$ENV{HTTP_REFERER};
$reff=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
} $head.=" $reff";
$from_address="a".$to_address;
open(MH,"|$sendmail_path -t");
print MH "To: $to_address\nFrom: $from_address";
print MH "\n";
print MH "Subject: Visitor Info $head\n\nHTTP_REFERER $reff";
print MH "\n";
print MH "DNS $gothostbyaddr\nIP $ENV{REMOTE_ADDR}";
print MH "\n";
print MH "BROWSER $ENV{HTTP_USER_AGENT}\nWHEN $gt GMT";
print MH "\n";
print MH "FORWARDED_FOR $xf";
print MH "\n";
print MH "APPS $ENV{HTTP_ACCEPT}\n\n";
print MH "MVI CGI Script 1.3 http://mviscript.hypermart.net";
print "\n";
close MH;
print "Content-type: image/x-xbitmap\n\n";
print "#define name_width 1";
print "\n";
print "#define name_height 1";
print "\n";
print "static char name_bits[] = { 0x04 };";
print "\n";