2

I have "Your latest 5 visits" at the home page of the user when he logs on. It works great without any problem.

But then i want to change it. I dont know how i should do this, but someway somehow only count the user 1 time at the time, and not e.g 10 times if he visits/refresh your profile.

So should i do this with a time checker? And for how long should it only count 1? When should second count? I need some idea for this, as I dont know if i should make it count 1 time per 10 minutes or 1 time per 1 minute..

So a good solution/giving a good realistic minute tip will answer the question.

Karem
  • 17,615
  • 72
  • 178
  • 278
  • Maybe you should count only if user creates new session. This would be simple. Set session time to xx minutes and every time when new session is created for user you can count this as latest visit. – Ventus Sep 09 '10 at 19:43
  • 1
    yes i use sessions, so you say it would be good to store a session "visited" to 1, when it has been counted, and then first on their next session it will register again? But then i would need to create a session variable for each profile they visit? – Karem Sep 09 '10 at 20:00

1 Answers1

1

There are a number of tutorials about 'Your Last Visit'

http://www.tizag.com/phpT/phpcookies.php

Phill Pafford
  • 83,471
  • 91
  • 263
  • 383
  • This looks like a promising solution - then the only question would be how far in the future to set the cookie expiration to consider "one session". The tutorial uses two months, but I can imagine as short as one hour if that's how Karem wants to count visits. – pjmorse Sep 27 '10 at 21:15
  • it's all up to @karem, not hard to implement that change at all – Phill Pafford Sep 28 '10 at 14:14