function cpt($filename="compteur.txt"){ if (file_exists($filename)) { $fr = @fopen($filename, 'r'); if (!$fr) return FALSE; else { $count = fread($fr, 1024); fclose($fr); $fw = @fopen($filename, 'w'); if (!$fw) return FALSE; else { $count=$count+1; fwrite($fw, $count); fclose($fw); } } } else { $fw = @fopen($filename, 'w'); if (!$fw) return FALSE; else { $count=$count+1; fwrite($fw, $count); fclose($fw); } } return $count; } //$visites=cpt("compteur.txt"); ?>
![]() |
|
|