I don't think there is a 100% bullet proof way. One way to approach it would be upon login, update a database table with the login time and date of the user.
You could always provide the user with the ability to sign out where you could update the database table again and kill the session using PHP. Sites like Yahoo and MSN do this.
Another way would be to update a database table on a regular basis with the date/time the user last used a page.
If anyone has any other idea I would like to read them!