Send a Message
to smsabbir480

Comments

1

Joined

Jul 21, 2014

smsabbir480 Profile

Forums Owned

Recent Posts

Science / Technology

php online page viewer counter

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($filenam e,’r’); $counter = fread($fp, filesize($filename )); fclose($fp); $counter = $counter + 1; echo”Total page Viewers:”.$counter .””; $fp=fopen($filenam e,’w’); fwrite($fp,$counte r); 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.  (Jul 21, 2014 | post #1)