Forum Moderators: open
Would it be possible to do this in JavaScript? If so, how will it track who is viewing the page and what their order is among all the other viewers?
Please let me know if this would be possible.
Thanks!
Wes
First you need to assign each person a place in line. I would do this by setting a cookie with a timestamp in. Then, as long as no 2 people hit the site at the same millisecond, which is highly unlikely, each visitor would have a unique ID.
Then you have to have a server script which redirects them. It would have to keep a list of id's in the queue, when a user views this page, it checks their ID, looks up their position in the queue.
If it's not their turn then it would give them a waiting page, on the waiting page you'd use javascript to automatically try again in 10 seconds, so the redirect script would check their position again and the whole thing goes around and around.
Now, when it is their turn, they get redirected to the money shot. On this page there would be an auto-refresh that's set for the 1 minute they're allowed to spend on the page. Then they would be redirected to a goodbye page, which would erase their ID.
Then they can join the queue again if they wish.
So, in addition to the actual pages, you need:
JS to create the ID and do the auto-retry.
A simple database, in this case a TXT file will do, depending on the number of people you expect to be in the queue.
A server site script to act as your security guard.
Good luck.