$fichier = "cpt.txt";
$fp = @fopen($fichier, "r");
if (!$fp) {
echo "Impossible d'ouvrir $fichier en lecture";
exit;
}
$visites = fgets($fp, 8);
fclose($fp);
$fp = @fopen($fichier, "w"); // le fichier est ouvert en ecriture, remis a zero
if (!$fp) {
echo "Impossible d'ouvrir $fichier en ecriture";
exit;
}
$visites++;
fputs($fp, $visites);
fclose($fp);
$visites = ereg_replace("0","","$visites");
$visites = ereg_replace("1","","$visites");
$visites = ereg_replace("2","","$visites");
$visites = ereg_replace("3","","$visites");
$visites = ereg_replace("4","","$visites");
$visites = ereg_replace("5","","$visites");
$visites = ereg_replace("6","","$visites");
$visites = ereg_replace("7","","$visites");
$visites = ereg_replace("8","","$visites");
$visites = ereg_replace("9","","$visites");
echo $visites
?>