How to see if a user is online in a website with p

2020-02-08 09:48发布

I'm building a community website. Users will login and logout as usually.

I use the attribute status online/offline to set the user's status. But what if a user just clicks the X button or disconnects otherwise without logging out?

Lately my computer crashed, when I opened the site with my laptop I could not login because I don't allow login in two places. I go to PHPMyAdmin and I see my status still online. Is there any fix for this.

I tried the last_time activitiy thing but that doesn't work in case of a computer crash! And there was nothing neither interactivity or refresh to update the table.

13条回答
我命由我不由天
2楼-- · 2020-02-08 10:14

Well the real answer for ur question "How will i update the table without user interaction ?"

is MySql event scheduler , you schedule a an event (query) to be executed at whenever you wish even if the user is OFFLINE , read about it here (http://dev.mysql.com/doc/refman/5.1/en/events-overview.html)

查看更多
登录 后发表回答