Chat room technology-implementation of confidential discussion

Source: Internet
Author: User
Chat room technology-implementation of confidential discussion
Each chat room provides a chat function to facilitate chat users who need to communicate in private.
The following describes how to implement private chat in my chat room:
1. Processing of sent information
Every private chat is displayed on the screen of the user and the private chat object, which is invisible to others.
The statement content is processed and saved in the statement file!
// $ Split is the separator
Messagesend. php
<?
// Determine whether to speak privately
If ($ secret = "on ")
{
// Mark the speech <! -- + Private chat tag + object + Speaker + --> in which + represents the separator
// The first one marked as secret indicates private chat, followed by the chat object and its own name, so that the two can see
$ Message = "<! -- $ Splitsecret $ split $ talkto $ split $ name $ split --> <font color = ff0000> password discussion </font> $ message ";
}
Else
{
// If the first object is marked as "open", the object and its own name will be followed.
$ Message = "<! -- $ Splitopen $ split $ talkto $ split $ name $ split --> $ message ";
}
// Save it to the file
?>
2. Private chat display method
After reading each new speech, process and judge it first, and actively refresh the program.
Messageflush. php
<?
// Separate the speech content
$ Tempmessage = split ($ split, $ message [0], 99 );
// If the speaker is not a private conversation, or the target user is a private chat, or the user who sends the private chat is himself, this sentence is displayed; otherwise, it is not displayed.
If ($ tempmessage [1]! = "Secret") | ($ tempmessage [2] = $ name) | (
$ Tempmessage [3] = $ name ))
    {
// Display private chat
Print ("parent.u.doc ument. writeln (" $ message [0] ");");
    }
?>
Through this simple method, we implement private chat,
Note:
Before saving the file for processing, the judgment text before and after the speech has <! -- And --> are displayed on the screen.
You don't have to deal with it!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.