codice:
<?php session_start(); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Statistic counter</title>
<style type="text/css">
.scrittura{
font-family:Verdana;
font-size:11px;
}
</style>
</head>

<body>
<?php

// Modify if you want the colour of table and of its border
$colore_tabella='#66FFCC';
$bordo_tabella='#000000';

// Don't modify the code here below

$file="count.txt";
$data_oggi=date("d/m/Y");


// Prima volta in assoluto che si accede alla pagina
if (!(file_exists($file))) {
	$crea_file=fopen($file,"w");
	$inizio="1"."\n".$data_oggi."\n"."1";
	fputs($crea_file,$inizio);
	fclose($crea_file);
}
else {
	// Estrazione dati
	$dati=file($file);
	$visite_tot=$dati[0];
	$data=chop($dati[1]);
	$visite_oggi=$dati[2];
	
	$visite_tot=$visite_tot+1;
	
	// Controllo delle visite odierne
	if ($data_oggi==$data)
		$visite_oggi=$visite_oggi+1;
	else
		$visite_oggi=1;
	
	if(!isset( $_SESSION['add_to_counter'])) {
		// Scrittura dati su file
		$scrivi_file=fopen($file,"w+");
		$dati=$visite_tot."\n".$data_oggi."\n".$visite_oggi;
		fputs($scrivi_file,$dati);
		fclose($scrivi_file);
		$_SESSION['add_to_counter'] = 1;
	}
	
	// Visualizzazione dati
	$tabella = "<table  cellpadding='0' cellspacing='0'  style='border:0px solid;'>";
	$tabella .="<tr><td></td></tr>";
	$tabella .="<tr><td><div class='scrittura'>Visite totali: $visite_tot
";
	$tabella .="Visite oggi: $visite_oggi</div></td></tr></table>";
	
	echo $tabella;
}
?>


</body>
</html>