Jump to content


Photo

Help with a visitor tracker I'm writing


  • Please log in to reply
1 reply to this topic

#1 DaveLinger

DaveLinger
  • Members
  • PipPipPip
  • Advanced Member
  • 268 posts
  • LocationWV, USA

Posted 21 October 2006 - 05:05 PM

so here's the deal. I need a visitor tracker that will seamlessly track my number of page views and unique visitors both total and PER DAY.

So far I have the following up and working:

When someone hits my script, it checks my db table to see if their IP already has a row (each row in the table is one IP address and its info). If it does, it adds one to that row's "hits" column. If it doesn't, it adds in all of its data and makes "hits" 1. So then to get the total hits I just add all of the "hits" column values together, and to get total uniques I just count the rows.

That brings the problem of "per day", though. Couldn't I somehow tell php to every night at midnight see how many more hits/uniques there are than yesterday and save that data to a different db table? Or am I doing this all wrong?
http://www.DaveLinger.com
dave at linger dot com

#2 JasonLewis

JasonLewis
  • Members
  • PipPipPip
  • Advanced Member
  • 3,351 posts
  • LocationVictoria, Australia

Posted 22 October 2006 - 12:00 PM

you could use cron. search google or phpfreaks for more info on cron jobs.
Good luck with your coding.
Jason / ProjectFear / Jaysonic




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users