In php for checking users status (online/offline) I use a code that runs on every page load and do an update on last_activity
users column. if last_activity
is more than 5 minutes user will be offline and signed out.
But there is a problem with this code:
It runs on every page load, but if user do not reload page or load any pages, this code won't work and show him/her offline after 5 minutes reading a pagem in some cases maybe it takes 1 hour to read an article in a page and I want to show user online while user is reading a page too.
I thought maybe I can do it with mouse scrolling in JS but its impossible!
So anybody did this before or any solution for this? (In php or js/jquery)