How to find online users and their names on site?

How to find online users and their names on site?

Which site you are talking about. Is that you trying to implement some pre-made script available online and got stucked up somewhere

Which site you are talking about. Is that you trying to implement some pre-made script available online and got stucked up somewhere

I am developing my own website I want to listout online members and their names on webpage. I allow only registered user to enter into the website so only registered users can access my website

Member Avatar
diafol

You'll probably need DB sessions/login.

I am developing my own website I want to listout online members and their names on webpage. I allow only registered user to enter into the website so only registered users can access my website

create another column named 'Status' in the usermaster table of your database and while the user logs in set the status to 'active'.So on your webpage you can get the count of all the online or logged in user as

"select count(*) from usermaster where status='Active' "

Similary set the status to inactive while logging off from the website

Member Avatar
diafol

Just to jump in there - if user doesn't log off - permanently active. Perhaps the status should be changed to 'last impression' field, so that users only active if opened new page in say last 20 minutes, regardless of whether user is logged in. There are more sophisticated methods of course, but this seems reasonably lightweight.