I have a situation where I don't know how to search for solution, please help me:
User gets for every minute staying on the site 1 credit. Credit is updated each minute, even if the page is not reloaded. But also if the page is reloaded or user continue browsing to other pages inside our site, counter should continue where it stayed in the previous page. If the user leaves the site it doesn't need to continue.
On each 5 seconds call with ajax timer.php where you assign time to the session.
Do sql call for each 5 seconds. I guess this is not ok because it is too wasting.
Any other solution?