![]() |
one on one chat (php)
hey,
im working on a site which involves a counselor who meets with students and each student needs to be in a chat room one on one with a counselor. their username will be their registration username. i looked at a few php/ajax/jquery applications and some range to simple to highly complex. thats one part i gotta figure first lol.. now my question is if i have the chat window on one page being chat.php how would have all students see only their own individual chats including the counselors for their session. would the page load something like this? chat.php?session=users_id_orsomething. |
It may not be the best way, but this should work:
When a student enters, create a row in the database containing a primary key, the ID of the client and helper, along with a (somewhat long, maybe ten char) alpha-numeric ID tag. This alpha-numeric tag is what you use via get to make sure that no one can jump in a chat session. When the conversation is over, delete the row. For internal purposes, use the PK from the temp row. This is because it is faster to search via a PK than a varchar. So your DB structure would be something like: Table chats int(9) id Primary Key Auto Incrementing int(1) from text message Table sessions int(9) id Primary Key Auto Incrementing int(9) agentId int(9) chatsId varchar(10) external_key You then find the sessions row with the external key matching the GET data. From there, use the chatsId to pull the records you need. |
| All times are GMT. The time now is 08:48 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0