I still can't figure this out. I don't know how boards like phpbb2 knows what messages and forums have new posts since the last time someone logged on. If you update the session every time he logs on then there new icon would never appear because the updated time will be greater than the last post for a forum or a thread. How are there session handles written?

How can I record the time whenever a users leaves my page for another page or closes the browser?

Can anyone give me a good explanation and some code?