tags:

views:

51

answers:

2

Hi, I want to make a script that will list online users when they enter a page. Simple way is record newly entered users into MySQL and list them for example every second. But I don't think it's a good idea with tons of users like in a facebook app come in and out of the page. There would be a way with Flash and PHP sockets but I really don't want to use Flash either. So is there any option left?

+1  A: 

Assuming you are using a login sistem so you have all the info you need stored somewhere in your database!

you can use sessions!

here there is also a solution on stackoverflow

aSeptik
+2  A: 

Maybe you can use Memcache to store the users' information such as sessions for large amount of frequent query.I think it's an easy and effective way to do your job.

SpawnCxy
Memcache is workable. Redis has some additional features that make implementation simpler, and it adds some persistence, making the data a bit more durable than memcache. One thing we ran in to implementing this: on a high traffic site, you'll be updating and reading this data several times per second, and your dataset will probably approach a few megabytes in size. So it's pretty important to make sure that you're not using a huge datastructure stored in a single key -- instead you need to spread data over many keys, so that you aren't writing/reading megabytes for every request.
Frank Farmer