update ---- I have found a simple solution that will work in my situation. I am going to use a file exist statement to check to see if lock.txt exist. Lock.txt will be re-created everytime someone requests a page on my server. lock.txt will be checked by the following php script:
<?php
$file = "lock.txt";
$filelastmodified = filemtime($file);
if((time() - $filelastmodified) > 30)
{
unlink($file);
}
?>
This script will be initiated by a user waiting to use the app.... So once lock.txt is deleted (30 seconds since last modified), they will be allowed to login... Not a perfect solution but should limit simultaneous connections.....
I have been searching the last two days for a simple solution to my problem.
I have setup a home web server driven by PHP 5 and Windows IIS 7. I'm trying to setup a PHP webpage that can only be accessed by one user at any given time. The single user will be accessing a controller through serial COM1 interface. If more then one user can access the controller, undesired effects will occur. I have tried locking down the webpage with PHP sessions but if the user does not log off correctly the session will still be active. I have also tried using blur function in AJAX to detect if the browser is closed, but it doesn't work in every situation.
Ideally it would be nice to setup an waiting queuing system where someone can play with the controller for a given set time, and log them off when there time is expired, but this would take a lot more effort. I just need something simple that will only allow one user at a time access, and to deny any other requests until it is open again. Any suggestions? Thanks in advance!