antonvrg

PHP Flat file Hit counter

Aug 24th, 2011
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.32 KB | None | 0 0
  1. <?php
  2. // variables (change these)
  3. $file = 'pageloads.log';
  4. $dispay = TRUE;
  5.  
  6. // adds +1 to the count
  7. $count = file_get_contents($file);
  8. $newcount = $count +1;
  9. $handle = fopen($file, "w");
  10. fwrite($handle, $newcount);
  11. fclose($handle);
  12. if($display = TRUE) {
  13.     echo "Pageloads: $newcount";
  14. }
  15. else {
  16.     //do nothing
  17. }
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment