03-10-2007, 09:55 AM
1. Create a new folder named "counter"
2. Create a file named "counter.php"
3. Create a file named "counter.txt" - it will be used as a database.
4. Paste the following code into the "counter.php" file:
[code:1]<?
$fp = fopen("counter.txt", "r");
$visits = fread($fp, 1024) + 1;
$fp = fopen("counter.txt", "w");
fwrite($fp, $visits);
print "document.write('$visits');";
?>[/code:1]
5. Place this on your HTML pages where you want counter to be displayed:
[code:1]<script language="JavaScript" src="http://.../counter/counter.php"></script>[/code:1]
You should change "..." to the URL which is pointing to the "counter" folder.
Enjoy your simple visits counter.
2. Create a file named "counter.php"
3. Create a file named "counter.txt" - it will be used as a database.
4. Paste the following code into the "counter.php" file:
[code:1]<?
$fp = fopen("counter.txt", "r");
$visits = fread($fp, 1024) + 1;
$fp = fopen("counter.txt", "w");
fwrite($fp, $visits);
print "document.write('$visits');";
?>[/code:1]
5. Place this on your HTML pages where you want counter to be displayed:
[code:1]<script language="JavaScript" src="http://.../counter/counter.php"></script>[/code:1]
You should change "..." to the URL which is pointing to the "counter" folder.
Enjoy your simple visits counter.
