#!/usr/bin/perl
print "Content-type: text/html\\n\\n";
$dbfile = "Visitiors.txt";
$onetime = 300; #разница в секундах - сколько юзверь, ещё не
#загружавший 2ю, 3ю, и т.д. страницу считается всё ещё сидящим
#на сайте.
$count = 1;
$currtime = time();
$remoteaddr = $ENV{\'REMOTE_ADDR\'};
open(INF,$dbfile);
@indata = ;
close(INF);
unlink($dbfile);
open(OUTF,">$dbfile");
close(OUTF);
chmod (0777,"$dbfile");
foreach $i (@indata) {
chop($i);
($time,$address,$host) = split(/\\|/,$i);
if (($currtime - $time) <= $onetime) {
if ($address ne $remoteaddr) {
$count = $count + 1;
open(OUTF,">>$dbfile");
print OUTF "$time|$address\\n";
close(OUTF);
}
}
}
open(OUTF,">>$dbfile");
print OUTF "$currtime|$remoteaddr\\n";
close(OUTF);
print "Народу у нас пасётся на сайте: ~$count\\n";
exit;