hit counter
Moderator: General Moderators
-
tobie montana
- Forum Newbie
- Posts: 1
- Joined: Sat Jul 31, 2010 8:34 am
hit counter
Heya, i wonder if someone could help me make a kind of advanced hit counter, It should only count a visit from 1 computer each 24/h so if i visit the site several times with my computer 1 day it will only count 1 time that day. Then if you are the 100th visitor you should come to another site. Thanks in advance // Tobie Montana
Re: hit counter
What kind of help are you asking for? If you want someone to write it for you, good luck. If you just want some tips about the logic, maybe I can help. Where do you want to store the visits, in cookies on the visitor's computer or in a database on the server? Each has its own advantages and disadvantages. If you want to use cookies, the logic would be something like this:tobie montana wrote:Heya, i wonder if someone could help me make a kind of advanced hit counter, It should only count a visit from 1 computer each 24/h so if i visit the site several times with my computer 1 day it will only count 1 time that day. Then if you are the 100th visitor you should come to another site. Thanks in advance // Tobie Montana
Code: Select all
Is there a cookie on the user's computer? If no, this is visit #1, set cookie; if yes, is the cookie date today's date? If no, increment the visit count, store back to cookie; if yes, ignore.
If this is visit #100, do whatever.Code: Select all
Query your database: is there a record for this user (or IP address)? If no, this is visit #1, insert record; if yes, is the date today's date? if no, increment the visit count, update record; if yes, ignore.
If this is visit #100, do whatever.