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";

In reply to please help to exclude my own IP address. by amalgama

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.