Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Closed Thread
 
Thread Tools Display Modes
Share |
  #1  
Old 07-13-2014, 07:34 AM
smsabbir480 smsabbir480 is offline
Junior Member
 
Join Date: 03-19-14
Posts: 23
iTrader: 0 / 0%
Smile 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 Code:
<?php
$filename
=”counter.txt”;
//open the file for reading
$fp=fopen($filename,’r’);
$counter fread($fpfilesize($filename));
fclose($fp);
$counter $counter 1;
echo”<b>Total page Viewers:.$counter.</b>;
$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′ 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.
 

Advertisement

Advertisement

  #2  
Old 07-16-2014, 12:12 AM
george.markou13's Avatar
george.markou13 george.markou13 is offline
Contributing Member
 
Join Date: 10-30-13
Location: athens
Posts: 106
iTrader: 0 / 0%
Better use session, so it wont count every time, the same person refreshes the page.
 
  #3  
Old 07-16-2014, 06:30 AM
snakeair snakeair is offline
Super Moderator - Rest in Peace 2018
 
Join Date: 12-31-07
Location: Medford, NJ
Posts: 54,771
iTrader: 3 / 100%
This was asked already.

Next time give credit when you steal content.

http://superuser.com/questions/78261...viewer-counter
 
Go Back   Webmaster Forum > Web Development > Coding Forum

Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Online Users Counter with No Bandwidth Consumption UnP0ssible Coding Forum 11 04-18-2011 05:53 PM
Problem with simple page counter using PHP and mySQL AdrianC Coding Forum 1 03-12-2011 10:47 PM
Embed Simple viewer in DW template page lajones3 Coding Forum 4 07-21-2007 05:35 PM
Can't see Flash Image Viewer once page is uploaded lajones3 Coding Forum 2 11-29-2006 03:39 PM
Page Hit Counter alvinzxx Coding Forum 2 11-21-2006 10:48 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 07:36 PM.
Powered by vBulletin
Copyright © 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC