Im developing a simple attendance system for my organization im updating the checkin and checkout on session base so when the user get login and its session created i stored the the time in database and when he logout and the session and distroyed i update the field of checkout and count the total hours but now what i need is that if user close the browser with out distroying the object how could it be possible to store its value. I think i need to use javascript for that but if anyone provide help would be great
Thanx in Advance

An alternative to JavaScript, is to explore using the PHP SessionHandler class. This allows you to hook into the logic that is called when sessions expire or are garbage collected.

When a user logs in, if you stored their session id against their profile in the database, you could log them out when their session is collected by the garbage collector due to inactivity - i.e. they've closed their browser or left their computer.