- Codice: Seleziona tutto
<?php
session_start();
$database_txt = "visite.txt";
if( (file_exists("$database_txt")) == false )
{
touch("$database_txt");
chmod("$database_txt", 0664);
$db_file = @fopen("$database_txt","w");
@fwrite($db_file, 1);
@fclose($db_file);
}
if(!$_SESSION["views"])
{
$tot = file("$database_txt");
$tot[0]++;
$db_file = @fopen("$database_txt", "w");
@fputs($db_file , $tot[0]);
@fclose($db_file);
$_SESSION["views"] = 1;
}
?>
funziona bene ma è già 2 volte che mi capita che riparte da 1... poi le riaggiusto io e funziona, anche se non ricordo mai il numero esatto... quindi metto sempre meno, è una cosa antipatica ma non capisco il problema, ammesso che ci sia





.

