nutt318 Posted February 9, 2009 Share Posted February 9, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/144538-solved-waiting-queue-need-help-with/ Share on other sites More sharing options...
nutt318 Posted February 10, 2009 Author Share Posted February 10, 2009 any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/144538-solved-waiting-queue-need-help-with/#findComment-758827 Share on other sites More sharing options...
JonnoTheDev Posted February 10, 2009 Share Posted February 10, 2009 I would suggest a simple mysql database table to store the users and flag who is active. As far as the switching of users after a time period I would suggest php & AJAX. Quote Link to comment https://forums.phpfreaks.com/topic/144538-solved-waiting-queue-need-help-with/#findComment-758932 Share on other sites More sharing options...
nutt318 Posted February 10, 2009 Author Share Posted February 10, 2009 neil, do you know of any example code or scripts that already have this? I am new to php and wouldnt know where to begin using it with AJAX. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/144538-solved-waiting-queue-need-help-with/#findComment-758941 Share on other sites More sharing options...
premiso Posted February 10, 2009 Share Posted February 10, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/144538-solved-waiting-queue-need-help-with/#findComment-758943 Share on other sites More sharing options...
JonnoTheDev Posted February 10, 2009 Share Posted February 10, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/144538-solved-waiting-queue-need-help-with/#findComment-758993 Share on other sites More sharing options...
nutt318 Posted February 10, 2009 Author Share Posted February 10, 2009 Thanks for you help. I'll see what I can do. Quote Link to comment https://forums.phpfreaks.com/topic/144538-solved-waiting-queue-need-help-with/#findComment-759039 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.