TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 10-25-2008, 04:48 PM   #1 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default 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.
__________________
no signature set
sarmenhb is offline  
Reply With Quote
Old 10-26-2008, 12:56 AM   #2 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

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.
__________________

Village Idiot is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 04:45 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design