The usual chat room using the program, that is, the chat program, the basic structure of the principle will not be used to the database. What kind of technology does it take? We know that the function of the session variable in an ASP variable is to record the information of a single user and to track the user's behavior.
a global variable that application the role of the object, and can be used to share information among multiple users of the site in the page.
that can be imagined, in the current chat program, a chat member is a session variable, chat members of the conversation as a application variable to share the display, so that members can see.
The following is a very classical example of the process of understanding and analysis.
1,chat.asp
<%if Request.ServerVariables ("request_method") = "Get" then%> <form method= "POST" action= "chat.asp" > < Input type= "text" name= "Nick" value= "Your nick name" ><p> <input type= "Submit" value= "Come in" ><p> & Lt;input type= "hidden" name= "Log" size= "1" > Value= Else </form><%response.end Dim response.clear If Request.Form ("Nick") <> "then session (" Nick ") =request.form (" Nick ") End If%><form method=" Post action= " Chat.asp "Name=form1> <%=session (" Nick ")%> speak: <input type=" text "name=" talk "Size=" ><br> < Input type= "Submit" value= "Submission" > <input type= "reset" value= "Cancel" ></p></form><a href= "chat.asp" > Leave </a><br><%if request.form ("log") <>1 then If trim (Request.Form ("talk")) = "" Then talk= Session ("Nick") & "If you don't say a word, you want to be perfunctory." Else Talk=trim (Request.Form ("talk")) End If Application.Lock application ("show") = "From" &request.servervariables ("REMOTE_ADDR") & "_" &sessioN ("Nick") & "in &time&" said: "&talk&" <br> "&application (" show ") Application.UnLock Response.Write Application ("show") End if%>
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.