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