I have php function like this at start of my code:
<?php
session_start();
if(empty($_SESSION['visited'])) {
$counter = file_get_contents('../visitCount.txt') + 1;
file_put_contents('../visitCount.txt', $counter);
$date = date('d/m/Y');
$dailyCounter = file_get_contents("../visitCount_" . $date . ".txt") + 1;
file_put_contents("../visitCount_" . $date . ".txt", $dailyCounter);
}
$_SESSION['visited'] = TRUE;
As you can see what I want to do is have file with name visitCount_XX/XX/XXXX.txt
but problem is that file is not appearing (saving) but first one (with static name does).
I have tried changing ''
to ""
just like it is in example now. I have typed echo($date);
after everything and it shows me correct date. Why it Is not working?