#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    139
    Rep Power
    14
    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.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    27
    Rep Power
    0
    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.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    300
    Rep Power
    14
    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...
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    139
    Rep Power
    14
    Right Dwarf, very very resource heavy...an option but not the best =/

    Went looking around - turns out it's been done in PHP
    http://www.igl.net/php/page.php?p=se...dder&nolimit=1

    This one's also nice because it shows what part of the site they're at. Any other suggestions?
  8. #5
  9. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    Perth West Australia
    Posts
    757
    Rep Power
    15
    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.

    ------------------
    Simon Wheeler
    FirePages -DHTML/PHP/MySQL
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    300
    Rep Power
    14
    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...

Similar Threads

  1. Category count in loop
    By wjones8050 in forum PHP Development
    Replies: 3
    Last Post: February 18th, 2009, 10:27 AM
  2. Users online??
    By aero in forum PHP Development
    Replies: 3
    Last Post: December 10th, 2003, 03:02 PM
  3. $2.95/month gets the best hosting online!
    By hostwithmost in forum Web Hosting Offers
    Replies: 4
    Last Post: November 21st, 2003, 10:25 PM
  4. storing creditcard details online
    By Jenkz in forum Security and Cryptography
    Replies: 9
    Last Post: August 7th, 2003, 07:57 AM
  5. need simple filesystem/directory listing help
    By tdev in forum PHP Development
    Replies: 2
    Last Post: June 24th, 2002, 08:07 PM

IMN logo majestic logo threadwatch logo seochat tools logo