BASIC GOALS:
I have page that I only want one person to be able to view at a time. I need to create a queue that will let each new user know how long (wait time) it is until they can access the page and how many people are in front of them.
LOGIC TREE:
This is sort of what I'm thinking the flow/logic should work like. It's not totally in order so I hope it makes sense.
Person A enters control.php
$AllowablePageTime=60(seconds)
Examine Records and delete any records that are more the 60 seconds past their start time + wait time (stale records)
SQL Insert Into TABLENAME (ID[auto increment]), SESSION ID, SERVER TIME, WAIT TIME)
(wait time in this case is 0 since they are the first user, they get access immediately)
Person B enters control.php
if any session_ID exists in TABLENAME then do the following
if session_ID matches the current users Session_ID(this checks to see if they were already place in the queue and really checks to see if they are coming from the queue) then load the page
Else
Using the server time from the most recent entry, figure out the wait time for User B.
SQL Insert Into TABLENAME (ID[auto increment]), SESSION ID, SERVER TIME, WAIT TIME)
Set $Wait to the value from the calculation above and carry that across a page redirect
to queue.php. Load that variable into a javascript that displays a countdown till the user
is allowed access. When the countdown has reached 0 the javascript will redirect back to
control.php where it SHOULD allow them access because they SHOULD be the most recent entry)
The stale record check should delete the most recent entry basically incase a user logs off before their time is expired so that when we redirect back to the control page, the user shouuld have the most recent record in the db.
SUMMARY:
This may be a bit confusing from the info above but I will attempt to summarize. Person A enters the page and is allowed to use the page. Person B comes along gets redirected to a queue page until person A's time is up, when it is ,Person B is automatically redirected back to the main page. This needs to continue on down the line for all subsequent users. Somewhere the AllowableTime variable needs to carry across and be used in the calculations so that an admin can adjust the allowable time to their liking.
NEEDS:
Develop a clearly understood logic tree so that I can ATTEMPT to figure out the coding myself.
If you get really bored, possibly give me the proper functions to use.
Thanks i advance and sorry for the blab, but hopefully the more detail the better.