PDA

View Full Version : Private Messaging


wiseguy89
04-23-2008, 08:00 AM
If I wanted to program a private messaging system for my users, what would be the best way to accomplish that?

idalatob
04-23-2008, 08:52 AM
Hmm, a really broad message. Try to keep your questions more precise as this would really help us answer your questions. But seeing as im bored and feeling kind, Ill try to help you out.

Its really pretty simple, but I suppose it depends on how complex you want to make it.

If you have a members table already then your good to go, just create a table in a database (assuming you are going to/ are already using one) and call that table 'messages'. with the following fields:

id, receive_id, sent_id, subject, message.

Then every time somebody sends a message, make the receive_id the member_id of the recipient and the sen_id the member_id of the person who sent the id.

hammer65
04-23-2008, 03:56 PM
Database based chat systems are the most common, but if you are already using the database for other things, you might be hitting it a little too hard with that kind of traffic, depending on how many people you have chatting at any given time.

Doing a web interface for chat is a little complicated, mostly due to the fact that chat systems usually use a persistent socket connection, whereas a web site is accessed via a stateless HTTP connection. There are Flash based chat systems that take advantage of Flash's socket support and similar Java based systems. It's conceivable that using PHP's IPC/shared memory extension, you could communicate with a socket server using AJAX/PHP, but I have never tried anything like that.