Page 1 of 1

NUmber of Users online

Posted: Mon Jul 13, 2009 5:11 pm
by Supercops
Hello All

Could you please let me know of any good php script that tell us the number os the users online on that Website . ?

Re: NUmber of Users online

Posted: Mon Jul 13, 2009 5:25 pm
by Skara
To accurately gauge this, you would need ajax. However, all you'd really need to do to get a good estimate is log an IP with a timestamp in a database. After ~5 minutes have gone by, if that timestamp hasn't updated, delete the entry.

Re: NUmber of Users online

Posted: Mon Jul 13, 2009 6:53 pm
by jackpf
That's almost identical to what I do. It's pretty cool: http://jackpf.co.uk. Check it out if you so desire.

I don't use ajax though, it just seems like pointless server load...I just define a user as online if they've requested a page in the last ten minutes.

Re: NUmber of Users online

Posted: Mon Jul 13, 2009 7:19 pm
by Ollie Saunders
You don't need AJAX for this

First thoughts: You'll need to ubiquitously collect data on users that are online or not, involving sessions and some form of persistence and access to the persistence. The only way you could make this into a reusable "script" or library, as you're looking for Supercops, is if the site is using a MVC style system i.e. all requests are coming in at one point.

You cannot do this without access to the server. If you want to find out how many people are on a site you do not own you have little chance and even if you could do it you'd probably be breaking a law in the process, so don't! :-)