Вариант такой:
CODE:
<?
$file="count.txt";
$cy = date("Y");//текущий год
$cm = date("n");//месяц
$cd = date("j");//день
$newfile = fopen($file,"r");
list($num,$fy,$fm,$fd) = fscanf($newfile, "%d:%d/%d/%d");
fclose($newfile);
if ($fy!=$cy || $fm!=$cm || $fd!=$cd)
$num = 1;
else
$num++;
$newfile = fopen($file,"w");
if (@flock($newfile, COUNT_EX)) {
fwrite($newfile, "$num:$cy/$cm/$cd");
@flock($newfile, COUNT_UN);
}
fclose($newfile);
echo "document.write('$num');";
?>
$file="count.txt";
$cy = date("Y");//текущий год
$cm = date("n");//месяц
$cd = date("j");//день
$newfile = fopen($file,"r");
list($num,$fy,$fm,$fd) = fscanf($newfile, "%d:%d/%d/%d");
fclose($newfile);
if ($fy!=$cy || $fm!=$cm || $fd!=$cd)
$num = 1;
else
$num++;
$newfile = fopen($file,"w");
if (@flock($newfile, COUNT_EX)) {
fwrite($newfile, "$num:$cy/$cm/$cd");
@flock($newfile, COUNT_UN);
}
fclose($newfile);
echo "document.write('$num');";
?>