Okay.. I have a text counter that I am making, and it logs everyone's IP (it's supposed to log them only once..) and the time.. then it is supposed to open the IP log, compare the user's IP with all the IP's in there, if it matches, it uses -M ... > 1 to check if the timestamp is more then 1 day, which apperantly it doesn't.. what it does is just adds their IP each time they view the counter, and it adds 1 to the count.. this is the code I am working with...
#!/usr/bin/perl $count_file = "count.txt"; $ip_file = "ips.txt"; $ip=$ENV{'REMOTE_ADDR'}; $time=localtime( time ); open(COUNT,"$count_file") || die("Perl SNAFU $!"); ($count) = <COUNT>; close(COUNT); $count =~ s/\n//; open(FILE,$ip_file) || die("Perl SNAFU $!"); @data=<FILE>; close(FILE); $countem="0"; foreach $lines (@data) { chop($lines); ($ips,$times,)=split('=',$lines); if ($ip =~ /$ips/i) { if (-M /$times/i > 1) { $countem="0"; } else { $countem="1"; } # End IfTimes } else { $countem="1"; } # End IfIps } # End ForEach if ($countem) { $count++; open(COUNT,">$count_file") || die("Perl SNAFU $!"); print COUNT "$count"; close(COUNT); open(WRITE,">>$ip_file") || die("Perl SNAFU $!"); print WRITE "$ip=$time\n"; close(WRITE); } # End IfCount print "Content-type: text/html\n\n"; print "<\!--\n"; print "document.write(\"$count\");\n"; print "//-->";

In reply to Counter that won't work with the IP Log by Kage

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.