Chat room to achieve private chat (i)

Source: Internet
Author: User
A few good friends in the chat room chatting, there are always some topics are not want the same chat room other chat friends see, then chat room to support the private message will be what is necessary, to achieve a lot of whispering methods, now the tiger introduced the use of the session object to achieve it, Using the session object to achieve private whispers, there are advantages and disadvantages, because the application of the session object, in fact, is the use of client cookies. If the client cookies are not supported or closed, then the program will run a problem. So is using the Session object No good?? Not also, at least programming greatly reduced workload, imagine if you need to save the user's chat name, then use the session object can directly save his name, if there is no session object. The solution seems to be that only a few hidden textbox objects are stored in the form where the address is addressed, which can be handled more than a boring lock, but the benefits are widespread, even if the browser does not support cookies still available.
Speaking of which, we may try the Internet's numerous ASP chat rooms, try to the browser's security options (always accept cookies off) to see that the chat room is still normal to use. That would be a problem. Oh ~ ~ Don't look for the tiger's chat room to try .... My chat room also needs cookies to support. No Session object programming is really annoying lock a lot. and the default value of most browsers ' security configuration is always to accept cookies. So there is no need to be too but the heart, only a small part of the user is more special than teaching.
Now from the chat room to start, to deal with the speech, show the speech, step-by-step to let everyone know how to deal with, and finally add a whisper function
First of all, our chat room mainly provides the following elements: spokesperson (your name), action (shouting, hugging ...) And so on), the object (to whom does this sentence say?) ), the content of the four elements.
The name of the spokesperson (your chat name) is saved in the User hidden text box in the statement form so that whenever you speak, you can use Request.Form ("user") to get the name of the chat in the Says.asp program that handles the speech. And the action is provided by the dropdown box action, you can customize a lot of action types to meet the needs of different chat friends. The speakers are also selected by the Drop-down box Whoto, which lists the names of all users in the current chat room. How to judge a new user into the chat room and exit the processing, here is not to say. Because the construction of a complete chat room to do a lot of work. Finally, a says text box provides the speech content.
With these several main chat elements. We will be able to address the speech.
Please take a look at the following program fragment
 
' Get the words and filter the script statements
Usersays=request.form ("says")
If InStr (Usersays, "<script") >0 Then
Usersays= ""

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.