User system - Show online users.
Posted: Sun Oct 14, 2012 8:04 am
I tried set up a system which displays the currently online user.
I added a column to the users table, so when a user logs in, that column for the user is updated with a value 'online' is inserted into the table.
The member pages then just displays the users online, by checking the online column for a value.
And when they log out it updates the table with null value.
But I have the problem that if a user doesn't click 'log out' when they leave the website, the value in the table stays and shows the user always online.
So is there a better way to do this?
I added a column to the users table, so when a user logs in, that column for the user is updated with a value 'online' is inserted into the table.
The member pages then just displays the users online, by checking the online column for a value.
And when they log out it updates the table with null value.
But I have the problem that if a user doesn't click 'log out' when they leave the website, the value in the table stays and shows the user always online.
So is there a better way to do this?