Hi

Is it posible to display a list of members that are currently logged in on my website in PHP. Or should I use AJAX ?

Any ideas, and if possible how would I go about doing this.

Happy easter everyone :)

Recommended Answers

All 2 Replies

Well I think what phpbb does is it writes to a text file each username as they log in and removes their username from that text file when they log out. Then to display the list of usernames, phpbb then simply just retrieves the contents of that text file with the explode function. But in my preference, I would say welcome to the twenty first century. I would use mysql databases to record how long ago each user last visited a webpage and if a user last visited a page longer than an hour ago, they are then removed off the list or if they visit a new webpage, the new webpage url overwrites the entry for the existing url on the list for that user.

But when you say when a user logs out. What if they don't click the logout button. I know many people that simply close their browser and dont understand the problems they cause.
Surely there is a more complex and reliable method?
I beleive daniweb use what i'm trying to make at the top of the page once logged in. Do you think its PHP? Or perhaps AJAX ?

Thanks for the reply

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.