How do you handle multiple user in queuing system? - php

please click this link to show picture Im having a hard time analyzing on how I will create a queuing system where there is multiple user. Let us say that there is 2 user that is using a system how will i implement it? i dont get the logic on how it will be implemented. Like if the first user will tap the next button how will I update it as well that the queue number is update with the other user

Sounds like you need to use a database such as MySQL or MariaDB.
You would store the activity of each user's session in database tables. Of course, I could give you a more specific answer if your question were more specific.

Related

Make a Registration Bot with Telegram Bot API

I'm trying to make a bot that register an user on my website.
This bot should ask some key informations about the user like:
First Name
Last Name
Username
Email Address
Profile Link
In your opinion what is the best method to implement this feature?
I've seen somebody suggesting to use database in order to find out what message you've sent to user, and what information you have for the user and ask the missing one accordingly!
This particular way to solve this problem, could be effective but not so much efficient imho! Is there any way at all to use like a callback query or maybe give a message an specific id, so I can check whether the last message id is the "username_request" and respond accordingly?
Let me know
Oh by the way, I'm using PHP and the Webhook method!
For such tasks - there are solution. You need to install shapoapps/multibot_driver (composer require shapoapps/multibot_driver) for Laravel.
In this packet there are session manager. Its like sessions for web browser users. But only for messenger users (telegram, ...). After each user message received, you can record user input into the session on server side. When each new request(message) received, you read the data from the session and build the application logic.
Here's the documentation - https://github.com/shapoapps/multibot_driver
I'm working on a similar project at the moment.
I was thinking about some kind of syntax wherein you place the things you want to save, for example:
John,,,Hawk,,,JHawk,,,jhawk#gmail.com,,,https://www.url.com/
After saying
/adduser
John,,,Hawk,,,JHawk,,,jhawk#gmail.com,,,https://www.url.com/
inside the chat: you can split the message at the three commas (,,,) with PHP.
Otherwise you could:
Make some kind of transaction protocol to let the bot ask values per item after saying
/adduser
inside the Telegram chat.
Let me know how you think about these ways! Typing the three commas (,,,) once is not so much effort, but if you have to add multiple users a day... It could become very annoying..

General questions about database

I would like to create e-learning platform. So users will have a lot of things to choose (mostly available to view only for them) like:
add note
add movies to favorite
rate the instructor
And few options that auto save for each user like:
unanswered questions
wrong answer questions
movies in progress (user saw only 2 min from 5)
So what database or method I schould use for store that kind of data?
I do not want to use cookies because it needs to be save on user account and not on browser. User need to have that all on every browser or mobile device.
I wondering about json but...if I do so each user I'd will be available to view...so schould I use MySQL?
I would recommend that you build your own data logger, what i mean by this is build yourself a place to store every users data like an eManager if you would like.
Once this has been built you can then assign the eLearning courses using an ID to each of the users profile on your "eManager". Allowing you too keep track of each users progress etc.
The "eManager" could also save the users notes/wrong answers/unanswered questions, you could create surveys with a slider rating to rate the user. Honestly the limit is endless.
You can receive the data in two different ways:
(Personal) Either you can request that your users email you requesting a username and you generate a password and send it out to the user.
(Commercial) You build your eManager to recieve the data from the website which isnt too difficult to do.
It will be a long process and to answer your question in a different view practice SQL/PHP that would be your base make sure you can run more advanced query's and can confidently edit your DB etc.
Anymore questions just let me know, thanks.

How to build chat rooms attached for a single user profile?

I have a simple php user profile system that works like this: When user is registered he gets a specific url ?user. Therefore, other visitors can access his page.
What I want it to include chat application on users profile pages. But, every single user should have its own chat.
Which approach is the best, as I am a beginner in this? Should I put the messages from chat into the database or should I work with some log.txt files?
Any good tutorial for this would be helpful.
I found some tutorial for you: http://tutorialzine.com/2010/10/ajax-web-chat-php-mysql/
- looks like it could help you.
The only thing you need to adjust is to add room column in WEBCHAT_LINES table - that will be the unique name of the user, into which's chat room the chat line belongs. Then, when new chat line will be sent, you must save it to DB with apropriate room identificator. When you display the messages in chat, you must filter the results in each room to show only the lines for this particular room.
If you haven't use database before, there are plenty tutorials about mysql around the internet - it's not that difficult.
Good luck! And use Google when you'll have some doubts.

Rating and Like System Managment

I'm trying to integrate a rating and like system as part of a package to send to the end user (with unknown progamming skill).
My problem is how to manage the users (registered or not) that have already done an action.At this moment I'm using PHP session to keep stored for a week the information, but this isn't a good solution.Is it a good solution creating 2 tables (one for rating and one for like) to store the information? If I use this solution what's the most useful and "correct" information to retrieve if the user is not registered? And is it user-friendly?I have thought to store: username and the ip
I would extend the members's table with at least two new columns, likes and rating or create a new table (as you said) including the memberID with a reference(and an index) to store and select the data. I believe it's the best way. Unfortunately, in this case non-members cannot press like or rate, but it is a good reason for one to register. –

I am creating a Like button similar to Youtube or Facebook and I am having some trouble with storing unique likes

I have not started creating the code so I don't have anything to show, but what I am going to create is a simple button after each post on my website that allows users to "Like" the post. The only problem I have is figuring out what my MySQL table should look like for this feat. I want to add a 'rating' column in my 'tbl_posts' table that stores the count, but I'm not sure how to make it so that each user can only upvote the post once. Any ideas on how to create the database in this way?
Also, I want to create the "Like" button using jQuery. What do you recommend is the best way to create the Like button.
Gracias.
If you're talking about registered users on your page you could create a user_likes_post m:n relation between your post and user tables.
If you're talking about page visitors you'll have to resort to IP addresses and/or cookies to make sure everyone can upvote only once.
For the button itself i'd recommend jQuery UI
I recommend the best way to implement your like button is not to develop a new button, but to use the API:s of facebook to do that.
If you really feel the need to implement it yourself, you should have a UNIQUE column with user id in your SQL table.

Categories