php online page viewer counter

Since: Jul 14

Bangladesh

#1 Jul 21, 2014
PHP (hypertext pre processor) has changed the way of web development.Now-a-days we can develop web applications easily by PHP.It has made web developing easier.Now i am presenting an page counter made by php.Sometime in our website we want to see that how many times our webpage is viewed.So this page counter will help to do so.Here is the page counter script.
PHP sorce script:
<?php
$filename=”counter.txt”;
//open the file for reading
$fp=fopen($filename,’r’);
$counter = fread($fp, filesize($filename));
fclose($fp);
$counter =$counter + 1;
echo”Total page Viewers:”.$counter.””;
$fp=fopen($filename,’w’);
fwrite($fp,$counter);
fclose($fp);
?>
Explanation:
At first create a ‘txt’ file by ‘notepad’ or ‘notepad++’ in the xampp/htdocs folder and name it ‘counter.txt’.then inside the ‘counter.txt’ file write ’1&#8242; and save it.
After this copy this copy the PHP code and save it in the same directory where the ‘counter.txt’ file is located.After that implement the saved PHP code in your web page.Hope this will work.

Tell me when this thread is updated:

Subscribe Now Add to my Tracker

Add your comments below

Characters left: 4000

Please note by submitting this form you acknowledge that you have read the Terms of Service and the comment you are posting is in compliance with such terms. Be polite. Inappropriate posts may be removed by the moderator. Send us your feedback.

Science / Technology Discussions

Title Updated Last By Comments
News Pat Bates: Is innovation an economic growth tsu... 29 min sure 1
News "Science vs. Religion: What Scientists Really T... (Jan '12) 44 min Aura Mytha 67,106
News The Cheap Energy Revolution Is Here, and Coal W... 56 min Solarman 1
Mini Body Large Display, Joyetech eVic Primo 2 hr Vapesourcing1 1
News Ivanka Trump advocates for women, girls in trip... 4 hr anonymous 42
News Local entrepreneurs cashing in on Nano Utica (Sep '14) 8 hr Upstate Toilet Town 14
NEW Arctic Dolphin Arthur 80W Stabilized Wood B... 17 hr ecigvape1205 2
More from around the web