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.
Related
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.
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.
So I'm building a music social network in PHP and now I'm stuck at the newsfeed. It should work just as any other newsfeed (Twitter, Facebook ...) and at first point it should be as simple as possible.
I don't have any problem with displaying all the posts from my MySQL database from newest to oldest, but I only want to show posts by users that I follow.
I don't need exact code, just a theoretical explanation how to do it.
I have two MySQL tables - users and posts. Do I need anything else?
Thank you!
Save the user id of the users. Build an API to retrieve the information. Save it into your database and retrieve the info via ajax every minute or so. Simple.
Keep track of which users follow who, then retrieve the posts of the users that the current logged in user is following.
You dont need new tables for this, add a new column in your users table that holds an array of id's of the users you re following. And in your posts table a column which holds the id of the user to who the post belong.
I'm trying to create a members site using php where they can upload images (dynamically create thumbnails) and comments for all members to see. I want all uploads to be published only after admin approval.
I can do quite a lot of this (registration, login, and even basic upload)but would be grateful if someone can provide a link to any lessons or videos of how to put it all together. I really would like to learn how to do it rather than configure someone's script.
I've checked YouTube but cannot find exactly what I'm looking for.
Thanks
In order to do an approval system, I think the most simple way to do it is to have a field in a DB, for each comment, image, etc, named "approved", which can take a 0,1 or 2 as value.s
If it's 0, it means it needs approval. 1 means it's approved. 2 means it is disapproved.
Note that 2 is not really necessary. It's just to distinguish new entries from old entries that weren't approved.
Then, on the backend, you can only give access to the approval system to the admin. You can use the same approach to define admins, users, moderators, etc...
I'm creating a mobile game on various mobile platforms and have decided to use PHP/MySQL as the back end and communicate with this via JSON. (The game will be text based).
I'm lacking on idea's on how to implement this, the sort of logic i'm after is as follows;
User will need to register an account
User will enter the game lobby looking for an open slot
If there is a suitable game ready and waiting (not full and waiting for new players) then join
If not create a new game and await players
I was thinking of having 20 players for each game and only allowing the game to start when there's 3 or more players waiting. When there's 3 or more players waiting there would be a count down of say 60 seconds until the game began.
Now i know some of this might need to be done on the client side. I'm struggling on where to start!! So any idea's, code samples or links to reading material that may help would be very much appreciated.
thanks!
Based on comments, I'm guessing you're looking for some ideas on database schema, like Brad Christie suggests. So I'm going to start with that.
First, you'll need a table for the players. I'm guessing you already have one of those, but you'll probably want to include a field for the game ID that they're in.
Next, you'll need a table for the games. This is where you store information on the game itself, including whether it's active. To get the player count, you simply query the list of players with that game's ID. You could also keep track of player count and update it whenever the player leaves or joins the game, depending on a few factors.
Now, the game lobby itself. The exact method here really depends on how you want it to function. You can either use AJAX to keep a list of currently active games up to date (and set up some sort of chat system to let players talk while waiting), or you can use the game lobby as routing page. If you go the latter route, then query the active games, automatically dump the player into one that meets your criteria, then send the user to the 'main game page'.
Hopefully this will give you a solid outline on how to start. I'm afraid I can't help you much more unless I know more about your requirements.
For register a user you simply need a form and save that form in your database. When the user logs in the you query the database matching the password and user name.