| Posted by Michael Fesser on 12/19/07 18:23 
..oO(macca)
 >Facebook shows who's online by identifying which members have been
 >active in the last five minutes.
 >
 >how? I'm not sure? maybe some kind of authentication and reading the
 >apache access log? maybe some kind of database table?
 
 You just have to keep track of active sessions. One way to do this in
 PHP is to use your own session handler, which stores the session data
 and a timestamp in a DB table (or just the timestamp in the DB and the
 session data in flat files, whatever you like). Then you just have to
 fetch all records that were updated in the past 5 minutes or something
 like that.
 
 But even this is just a wild guess and never really accurate. As said,
 HTTP doesn't allow for accuracy here:
 
 * user sends request
 * user gets answer
 * user is gone
 
 It's always the same.
 
 Micha
  Navigation: [Reply to this message] |