Jump to content

Recommended Posts

I also need to ensure if a person just keeps refreshing the page that it won't keep incrementing number of views.

 

Your answer may be somthing like: "Just add a record to a table wheh view, then search table when need to find total number of views - ensuring only add unique record by IP for that topic"

Are you looking for pageviews, or for visits?

If you're looking for pageviews, then you'll probably have to accept that a dumb user will be able to do that (unless you want to try to code a script measuring the times between refreshes, and recognizing if it's malicious or not). If you're looking for website visits, I'd do something like this:

 

check to see if IP address is found in database;

if IP is not found in database {
     insert into database with current time and IP;
     add one to counter; 
}

Then, every hour or so, run a query deleting all visits more than a day old. (Probably using cron jobs).

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.