How To Write To Database User's Logout Timestamp When Browser Is Closed / Crash
<p>I have a table on my database called 'Log'. This Log table contains ID, Username, LoginTime and LogoutTime. That's all.</p>

<p>It's really easy to INSERT into ID, Username and LoginTime columns...</p>

<p>But dealing with LogoutTime, I was thinking there will be 2 condition :</p>

<ol>
<li><p>User click logout button >> PROBLEM SOLVED, I can easily put INSERT script on my logout.php to handle LogoutTime column.</p></li>
<li><p>User just run away from my website by clicking close button of their browser >> THIS WILL CAUSE A PROBLEM. How can I write to LogoutTime column in this situation like this?</p></li>
</ol>

<p>can it be handle by PHP only? I mean, doesn't have to use jQuery... Thanks before.</p>
