On Wed, March 5, 2008 2:08 am, Angelo Zanetti wrote: > I am implementing a system where when a user is logged in and out that > a > date time is set in a database for each action for each used. We can > then > trace who logged in a and when. > > No what I would like to know is how can I record when a user closes > the > browser or the session expires? There is no action for these items. So > what > would the best way be to keep a record of this? Would the use of a > cron job > be appropriate? I read in the archives that the banks use javascript > but I > don't want to go that route. > > If anyone has any idea how to do this please let me know, thanks in > advance.
There is no way to know when they quit/closed the browser or even just walked away and let the session time out. But you *CAN* easily log the last time they accessed any page, by adding something like: $query = "update user_profile set last_access = now()"; $access = mysql_query($query, $connection); if (!$access){ //error handling here } So you'll know the last time they actually DID anything, which is probably more interesting than recording when they closed the browser if they were looking at some other tab anyway. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php