Good day to all. I have a strange problem.
I created a PHP script that inserts into a database the unix timestamp when it was accessed (PHP - time() function).
开发者_运维知识库When a user is viewing a certain page a ajax request is send at every 57 seconds to the mentioned script.
I also created a cronjob that runs a PHP script that checks if the difference between the current time and the time logged in database for a certain user is higher than 2 minutes. The cron is set to run the script every 2 minutes, if is higher I mark the user as idle.
Now the problem is: Even though both seem to work fine, sometimes (seems very random to me) a user that is viewing the page is marked as idle. I can't find any explanation... perhaps any1 have an idea?
Unfortunately I can't provide an online version... but I answer any questions in max 10 mins.
The ajax script:
The insert script:
The cron:
Thank you for help.
Does your user hava Javascript enabled? Is your server getting the AJAX requests from that specific user?
精彩评论