Thanks
Code:
<?php
$counter_name = 'counter.txt';
file_put_contents($counter_name, date('Y-m-d H:i:s')."\n", FILE_APPEND);
$k = 0;
foreach (file($counter_name, FILE_IGNORE_NEW_LINES) as $dt) {
++$k;
echo "$k : $dt<br>";
}
if (!file_exists($counter_name)) {
$f = fopen($counter_name, "w");
fwrite($f,"0");
fclose($f);
}
$f = fopen($counter_name,"r");
$counterVal = fread($f, filesize($counter_name));
fclose($f);
$counterVal++;
$f = fopen($counter_name, "w");
fwrite($f, $counterVal);
fclose($f);
echo $counterVal;
?>
Date work but counter no:
2021-03-02 14:56:08
2021-03-02 14:57:41
2021-03-02 14:57:42
2021-03-02 14:57:42
2021-03-02 14:57:45
Counter must have first 1) < counter
Time not correctly...
5) 2021-03-02 14:56:08 - new must be above like 14:57:45
4)2021-03-02 14:57:41
3) 2021-03-02 14:57:42
2) 2021-03-02 14:57:42
1) 2021-03-02 14:57:45
correctly is
5) 2021-03-02 14:57:45
4) 2021-03-02 14:57:42
3) 2021-03-02 14:57:42
2)2021-03-02 14:57:41
1) 2021-03-02 14:56:08
Very thanks