Simple views counter (No DB used) 06-27-2011, 06:33 PM
#1
I needed this for a test, but I'm too lazy to use MySql, so I made this.
First create a "testFile.txt", and enter "0" (without quotes) in it. Then add this in a php file.
First create a "testFile.txt", and enter "0" (without quotes) in it. Then add this in a php file.
PHP Code:
<?php
$myFile = "testFile.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, 5);
fclose($fh);
intval($theData);
$theData = $theData + 1;
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $theData);
fclose($fh);
echo $theData;
?>
![[Image: rytwG00.png]](http://i.imgur.com/rytwG00.png)
Redcat Revolution!