Jump to content

Recommended Posts

I would like to have a queue on my website and so far have not found an example or script for what I want to do. Anyways I want a queue that people can enter their name and enter a queue. This queue will hold however many people join the queue and only let 1 person be active.

 

This active person I want to only allow them a few buttons on my site, after say 2 minutes this person gets kicked from controlling the buttons and the next person in the queue has access to the buttons.

 

Anyways does anyone know of a script or code already out there that does this? If not can someone point me in the right direction?

 

Thanks for your help.

Link to comment
https://forums.phpfreaks.com/topic/144538-solved-waiting-queue-need-help-with/
Share on other sites

I am not sure how it would actually work with PHP and AJAX. I know it is possible, given online chats.

 

You can try and google "Chat Queues PHP" and see what comes up as that may give you a base of code.

 

Me, I would code it in Java, but that is me. :)

My idea is as follows

 

Create a database table e.g.

 

queue

=======

id (INT)

name (VC)

status (ENUM 0,1)

startTime (DATETIME)

 

Once a user is added to the queue they are redirected to a waiting area. One user will have a status of 1. This is the current active user. Once the user is at the waiting area use AJAX to poll the database every x seconds to see if their user status has changed. An active user will have the buttons displayed for whatever time period. Buttons can be displayed using the DOM. You can query the active time period from the startTime field. When their time has expired their status is set to 0 and the next user is active. You could also store the user activity so if a user is inactive for a period of time their status is reset, etc..

 

As far as pre-built scripts I have no idea as I have never seen a need for such a mechanism

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.