Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking user visits | PHP

Tags:

php

Ok so I store the User ID and a PHP Timestamp on a db. What I want to do is check whether the user has visited on a daily basis. Something very similar to SO's visited system. I know that I should have the user's visit record.

But what I can't imagine right now is how do I determine the days that the user has visited and not visited. Any ideas? I really can't piece it together some help would be appreciated. A simple point to the direction if its ok. thanks


Edit:

I want to know the days the user has visited. Literally if the user visited on Nov. 1, 2013. I want to identify that but it wouldn't be just one day it would be each day since the user registered.

like image 856
Jo E. Avatar asked Jun 09 '26 02:06

Jo E.


1 Answers

Append your user table with the following columns:

  • visittime
  • visitcount
  • consecutive (boolean)

When a user visits, check if the visittime was more than a day ago, and update consecutive accordingly. Als increment visitcount if visited consecutively.

like image 110
Joren Avatar answered Jun 11 '26 17:06

Joren



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!