Check whether user is currently online (live)
<p>I've recently finished my application and I've got a huge problem. I need to allow only 1 user to access it at a time. There is an index page accessible for every user everytime and "start" button. When user clicks start, the application locks and other ppl need to wait until the user finishes. When the user closes tab/browser, the application has to unlock automatically. Each user has 5 minutes to use my app. 
I partially solved my problem, but it still doesn't work properly - on every site I set the jquery script that every 5 seconds triggers "extend.php" file on the server ($.get() function). The php file modifies time.txt file (it changs it to time()+5) and the script on the intex site checks whether (time()>time.txt content). So that when the uses closes tab/browser, the app is accessible. Obviously my app is also based on sessions (when the user closes browser, he loses access). 
On some computers it simply doesn't work (it seems jquery doesnt trigger extend.php file and it makes my app accessible all the time). 
So my question is: do you see any other ways to solve my problem?</p>

<p>The descr might be messy but I wanted to describe everything strightforward ;)</p>

<p>Regards. </p>
