samedi 19 septembre 2015

PHP Hit Counter with DATE

I'm using the following code for an hit counter:

$fp = fopen("counterlog.txt", "r"); 
$count = fread($fp, 1024); 
fclose($fp); 
$count = $count + 1; 
$fp = fopen("counterlog.txt", "w"); 
fwrite($fp, $count); 
fclose($fp); 

In the file I only have a number, but I would like to obtain a file in the following way:

18/09/2015  10
19/09/2015  11

So I want the count grouped by day and date separated by a tab.

I know I can use database for doing that, but in this specific case I want to use only text file.

Is possible to obtain that?




Aucun commentaire:

Enregistrer un commentaire