- <?php
- // Only allow the script to be run from nuel.pw
- header('Access-Control-Allow-Origin: https://nuel.pw');
- // Get the current value
- $fn = 'count.txt';
- $current = intval(file_get_contents($fn));
- // Only increment once per browsing session
- session_start();
- if ($_SESSION['count-nuel'] !== 1) {
- $_SESSION['count-nuel'] = 1;
- $current++;
- // Overwrite the text file with the new value
- $fp = fopen($fn, 'w');
- fwrite($fp, $current);
- fclose($fp);
- }
- // Return the updated value
- echo $current;