File size: 1.22Kb
<?php
error_reporting(0);
if (isset($_GET['sid'])) $sid=htmlspecialchars($_GET['sid']); else exit;
$date_data="./inc/data/date_of_".$sid.".dat";
$hit_data="./inc/data/hit_of_".$sid.".dat";
$daylog_data="./inc/data/daylog_of_".$sid.".dat";
$base=file($hit_data);
if (file_exists($hit_data))
{
$ft=fopen($hit_data,"w");
$base[0] = trim($base[0])+1;
if ($ft) fwrite($ft,trim($base[0])."\n");
}
$date=date("d-m-Y",time());
$a_date=file($date_data);
if ($a_date[0]==$date):
if ($base[1]) $base[1] = trim($base[1])+1; else $base[1] = "1";
if ($ft) fwrite($ft,$base[1]);
fclose($ft);
$fu = file($daylog_data);
if (!(strpos($fu[0], $REMOTE_ADDR) > -1))
{
$fu=fopen($daylog_data,"a");
fwrite($fu, $REMOTE_ADDR."¤");
fclose($fu);
}
else {}
elseif ($a_date[0] != $date):
$base[1] = "1";
if ($ft) fwrite($ft,$base[1]);
fclose($ft);
$fu=fopen($daylog_data,"w");
fwrite($fu, $REMOTE_ADDR."¤");
fclose($fu);
$fd=fopen($date_data,"w");
flock($fd,2);fputs($fd,$date);
flock($fd,3);fclose($fd);
endif;
if ($_GET['counters']!="text") {
if ((isset($_GET['counters'])) && ($_GET['counters']=="no")) include "./inc/nocounts.php"; else include "./inc/counter.php";
}
?>