The simplest ASP chat room (with source code)

Source: Internet
Author: User
<%@ Language=vbscript%>
<%
Response.buffer=true ' Sets the output cache for displaying different pages.
On Error Resume Next ' Ignores program error section
If Request.ServerVariables ("request_method") = "Get" Then
' Determine how the customer requests the WEB page
'------------------------
' Client Login interface
'------------------------
%>

<form method= "POST" action= "http://www.cs02.com/luo40.asp" ><p>
<input type= "text" name= "Nick" size= "value=" Nick "style=" Background-color:rgb (192,192,192) "><br>
<input type= "Submit" value= "into the chat room" name= "B1" style= "Color:rgb" (255,255,0); font-size:9pt; Background-color:rgb (0,128,128) ">
<p><input type= "hidden" name= "Log" size= "1" ><br></p>
</form>

<%
Response.End ' End of program processing
Else
Response.Clear ' Empty the contents of the cache
Dim talk
If Request.Form ("Nick") <> "then
' Determine if the customer is in the chat interface
Session ("Nick") =request.form ("Nick")
End If
'------------------------
' Customer Chat interface
'------------------------
%>

<form method= "POST" action= "http://www.cs02.com/luo40.asp" name=form1> <p><%=session ("Nick")%> said Words: <input type= "text" name= "talk" Size= "><br>"
<input type= "Submit" value= "submitted" name= "B1" >
<input type= "reset" value= "Cancel" name= "B2" ></p>
</form>
<a href= "http://www.cs02.com/luo40.asp" > Leave </a><br><br>

<%
If Request.Form ("log") <>1 Then
If Trim (Request.Form ("talk")) = "" Then
' Determine if the user has not entered any content
Talk=session ("Nick") & "Silence is Golden." "
Else
Talk=trim (Request.Form ("Talk"))
' Remove the space after the character
End If

Application.Lock
Application ("show") = "<table border= ' 0 ' cellpadding= ' 0 ' cellspacing= ' 0 ' width= ' 85% ' ><tr><td ', width= '" 100% ' bgcolor= ' #C0C0C0 ' ></td></tr><tr><td width= ' 100% ' ><font color= ' #0000FF ' > from ' &request.servervariables ("REMOTE_ADDR") & "&session" ("Nick") &time& "Say:</font>" & talk& "</td></tr><tr><td width= ' 100% ' bgcolor= ' #C0C0C0 ' ></td></tr></ Table><br> "&application" ("Show")
Application.UnLock

Response.Write Application ("show")
End If
End If
%>


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.