Idle Time Limit
This example demonstrates possibly one of the simplest ways to deal user sessions. Basically, as long as the user stays active, leave them logged in. In a final implementation, you'd do something smart like pop up a confirmation screen (with an additional, short timer) to ask if the user wants to remain logged in.