README.md
December 5, 2022 ยท View on GitHub
Description
This is just a simple hits counter that will display the following:
hits: 345
or whatever the file says
chmod "counter.txt" to 0777 for this to work
More Info
| Submitted On | |
| By | Jeff Cook/Moab Software |
| Level | Beginner |
| User Rating | 4.5 (36 globes from 8 users) |
| Compatibility | PHP 3.0, PHP 4.0 |
| Category | Internet/ Browsers/ HTML |
| World | PHP |
| Archive File |
Source Code
<?php
$file="counter.txt";
$handle=fopen($file, "r+");
$hits=fread($handle,filesize("$file"));
$hits+=1;
fclose($handle);
echo "$hits";
$handle=fopen($file, "w");
fwrite($handle, $hits);
fclose($handle);
?>