August 11th, 2000, 09:30 AM
Was just wondering how this can be accomplished in PHP.
I've seen it in Cold Fusion ( http://forums.anandtech.com/whoson.cfm?ALL=y ) and ASP, but haven't seen it in PHP I don't think. Obviously it's got something to do with sessions but other than that I'm stumped.
Any help would be appreciated.
August 11th, 2000, 08:30 PM
I haven't been working with PHP for very long , ...but I think it cannot handle a task like that. It would take an active script to ping users (or do something of the sort -- maybe check if their connection ports are still open).
...but, is there anyone with a more definative answer? I'd like to know this answer too.
August 11th, 2000, 08:44 PM
OK, I am very tired so please, bear that in mind when reading this post...(seting up Apache, mod_perl, PHP and MySQL, all from sources...Did I ever mention I love FreeBSD????)
I think something like that could be done with a database table and logins. For example, when a user comes to your site, you check for a cookie. If he has a cookie, you take the values within it and register a sesssion. Also, you write his username and current time in the temporary table. When another user arrives, you simply do a SELECT statement against that table and show results. When some user leaves your site, you end his session and remove his entry from the table...
Of course, I doubt that this is the right solution since it is resource-heavy (constant writing back-and-forth), but it would probably do the trick...Of course, this would mean that there is an SELECT statement on every single page...
August 11th, 2000, 11:28 PM
Right Dwarf, very very resource heavy...an option but not the best =/
Went looking around - turns out it's been done in PHP
This one's also nice because it shows what part of the site they're at. Any other suggestions?
August 12th, 2000, 01:18 AM
mmmmmm I think that the php site you listed probably works using the method that Dwarf describes, thats a guess by looking at the format of it.
I suspect (and this is another guess) that the cold-fusion forum gets its data directly from the server logs which is a whole different ball game altogher and requires a very very friendly (or your own) host!
Displaying users who have logged on is easy, using cookies even unregistered users can be tracked, tracking users in your site is still quite easy , but knowing when they have gone/left the site as they do not actually log out is the bugger.
August 12th, 2000, 04:25 AM
Well, yes, cookies can solve the problems, but how can you list users A, B, C and D to the user E if you have got nowhere to list them from?? That's why I suggested the database solution (which, as we concluded is not the best).
If there is something I am missing here, firepages, please let me know...