visitor counters

nuel.pw

6197 — Last updated: May 27 2023 23:39:10 UTC

globoform.com

3397 — Last updated: May 27 2023 20:46:11 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;