![]() |
|
[PHP]Simple views counter (No DB used) - Printable Version +- HN-Community (https://hacker-newbie.org) +-- Forum: Miscellaneous (https://hacker-newbie.org/forum-86.html) +--- Forum: Coding/Programing (https://hacker-newbie.org/forum-19.html) +---- Forum: Web Programing (https://hacker-newbie.org/forum-38.html) +---- Thread: [PHP]Simple views counter (No DB used) (/thread-11187.html) |
[PHP]Simple views counter (No DB used) - Me- - 11-29-2011 First create a "visitors.txt", and enter "0" (without quotes) in it. Then add this in a php file. Code: <?php
$myFile = "visitors.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;
?>RE: [PHP]Simple views counter (No DB used) - justinisal - 11-29-2011 Nice share bro :) simple sekali .... tapi ane enggak tahu isinya apa itu hahhaa
|