visitor counters

nuel.pw

13683 — Last updated: February 29 2024 08:42:35 UTC

globoform.com

4495 — Last updated: February 28 2024 22:40:06 UTC
My visitor counters only increment a number in a text file and flip a bit in your session variables to lightly debounce script execution. Small data says enough. Big Data Does Not Speak
Show code
  1. <?php
  2. header('Access-Control-Allow-Origin: https://nuel.pw');
  3. $fn = 'count.txt';
  4. $current = intval(file_get_contents($fn));
  5.  
  6. session_start();
  7. if ($_SESSION['count-nuel'] !== 1) {
  8. $_SESSION['count-nuel'] = 1;
  9. $current++;
  10.  
  11. $fp = fopen($fn, 'w');
  12. $contents = fwrite($fp, $current);
  13.  
  14. fclose($fp);
  15. }
  16. echo $current;