A simple access counter : fwrite « File Directory « PHP






A simple access counter

 
<?
    $access = "data.txt";               
    $visits = @file($access);           
    $current_visitors = $visits[0];     
    ++$current_visitors;                
    $fh = fopen($access, "w");          
    @fwrite($fp, $current_visitors);    
    fclose($fh);                        
?>
  
  








Related examples in the same category

1.Appending to a file
2.fwrite() function writes string to the file.
3.fwrite.php
4.Using file-related error information
5.Writing data to a file
6.Storing user information in a text file