PHP hit counter

Reply

Join Date: May 2009
Posts: 18
Reputation: tanmoy_india is an unknown quantity at this point 
Solved Threads: 0
tanmoy_india tanmoy_india is offline Offline
Newbie Poster

PHP hit counter

 
0
  #1
Jun 16th, 2009
anyone can give me code for a php hit counter for my website...that will count every user's click...plzz give with database & code...
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 340
Reputation: Josh Connerty is an unknown quantity at this point 
Solved Threads: 26
Josh Connerty's Avatar
Josh Connerty Josh Connerty is offline Offline
Posting Whiz

Re: PHP hit counter

 
0
  #2
Jun 16th, 2009
We aren't here to programm for you, we are here to help you program. Do you have any knowledge of PHP?
Posts should be like mini-skirts, long enough to cover enough, but not too long that you cover too much.

My Liveperson: http://liveperson.com/josh-connerty/
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 18
Reputation: tanmoy_india is an unknown quantity at this point 
Solved Threads: 0
tanmoy_india tanmoy_india is offline Offline
Newbie Poster

Re: PHP hit counter

 
0
  #3
Jun 16th, 2009
no actually I can't create a counter that will count every user...my counter count on every reload...thats why...
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 340
Reputation: Josh Connerty is an unknown quantity at this point 
Solved Threads: 26
Josh Connerty's Avatar
Josh Connerty Josh Connerty is offline Offline
Posting Whiz

Re: PHP hit counter

 
0
  #4
Jun 16th, 2009
Post your counter and I will take a look at it.
Posts should be like mini-skirts, long enough to cover enough, but not too long that you cover too much.

My Liveperson: http://liveperson.com/josh-connerty/
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 68
Reputation: djjjozsi is an unknown quantity at this point 
Solved Threads: 10
djjjozsi djjjozsi is offline Offline
Junior Poster in Training

Re: PHP hit counter

 
0
  #5
Jun 16th, 2009
if you need a simple one, why don't you search on google?
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 75
Reputation: mustafaneguib is an unknown quantity at this point 
Solved Threads: 3
mustafaneguib mustafaneguib is offline Offline
Junior Poster in Training

Re: PHP hit counter

 
0
  #6
Jun 16th, 2009
ill tell you the logic/alogrithm of what you can do.

use cookies or sessions but using cookies is better then you can record unique users. u create a cookie, and that cookie gets saved in ur computer's hard drive. delete the cookie after every 24 hours. you can set this when you create the cookie.

when u come back again check if the cookie exists or not. if it does then your visit will not be recorded as youhave already visited that day. if the cookie does not exist then your visit will be logged as it will be your first visit that day.

now convert this logic/algorithm into code.
If one has not had the chance to do assembly prgramming then he has not had the chance to do programming at all.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 982
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 128
ardav's Avatar
ardav ardav is offline Offline
Posting Shark

Re: PHP hit counter

 
0
  #7
Jun 16th, 2009
Google 'php page counter' - script bunny heaven. Hotscripts and Sourceforge have loads of amazing free stuff, but some of them tend to be a little over-the-top for what you need.

You could cookify it like suggested above or your best bet would be a total MySQL solution. However, you'll need to "bone up" a bit on your php for this.
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count - unless you're a serial downvoter.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 1,075
Reputation: digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice 
Solved Threads: 66
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Veteran Poster

Re: PHP hit counter

 
0
  #8
Jun 16th, 2009
Originally Posted by tanmoy_india View Post
no actually I can't create a counter that will count every user...my counter count on every reload...thats why...
When talking about website statistics, usually a "hit" refers to the access of any resource on the server such as html files, images, audio, video etc.

that will count every user's click...plzz give with database & code...
Do you want to count unique visitors, or the clicks of each visitor, or both?

If you're counting clicks, then you most likely want the number of hits on php or html files. They are the same as clicks.

If you want unique visitors, then you need cookies like mentioned by mustafaneguib. There are already existing solutions:
eg: http://piwik.org/
Or services that provide visitor analysis such as google analytics.

A lot of this information is already available in the server logs, if you have a access logs enabled.

There are many existing parsers for server logs that display the log data visually.

eg:

http://www.webalizer.org/
http://awstats.sourceforge.net/

Usually, these are already existing on PHP enabled servers and is already built into CPanel .

Website statistics generated from log analysis do not contain visitor counts, or visit counts. This is because a visitor can only be identified well by a cookie (or other client side storage). IPs cannot be used since some users have dynamic IPs and some groups of users can use a single IP.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC