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?
User system - Show online users.
Re: User system - Show online users.
You could just do what phpBB does, and save the time in the column.
Check if the time was less than 5 or so minutes ago, if it was then set them as offline.
And you could just update the time every time they access a page.
SOURCE: http://www.phpeasystep.com/phptu/9.html
Check if the time was less than 5 or so minutes ago, if it was then set them as offline.
And you could just update the time every time they access a page.
SOURCE: http://www.phpeasystep.com/phptu/9.html