最简单的ASP聊天室(附源码)

1@ Language=VBScript 
1   
2Response.Buffer=true ' 设 置 输 出 缓 存,用 于 显 示 不 同 页 面。   
3On error resume next ' 忽 略 程 序 出 错 部 分   
4If Request.ServerVariables("Request_Method")="GET" then   
5' 判 断 客 户 是 以 什 么 方 式 请 求 WEB 页 面   
6'------------------------   
7' 客 户 登 陆 界 面   
8'------------------------   
1<form action="http://www.cs02.com/luo40.asp" method="POST"><p>
2<input name="nick" size="20" style="background-color: rgb(192,192,192)" type="text" value="nick"/><br/>
3<input name="B1" style="color: rgb(255,255,0); font-size: 9pt; background-color: rgb(0,128,128)" type="submit" value=" 进 入 聊 天 室 "/>
4<p><input name="log" size="20" type="hidden" value="1"/><br/></p>
5</p></form>
 1   
 2Response.End ' 结 束 程 序 的 处 理   
 3Else   
 4Response.clear ' 清 空 缓 存 中 的 内 容   
 5dim talk   
 6If Request.Form("nick")<>"" then   
 7' 判 断 客 户 是 是 否 在 聊 天 界 面 中   
 8Session("nick")=Request.Form("nick")   
 9End If   
10'------------------------   
11'客 户 聊 天 界 面   
12'------------------------   
1<form action="http://www.cs02.com/luo40.asp" method="POST" name="form1"> <p>```
2=Session("nick")
3``` 说 话:<input name="talk" size="50" type="text"/><br/>
4<input name="B1" type="submit" value=" 提 交 "/>
5<input name="B2" type="reset" value=" 取 消 "/></p>
6</form>
1<a href="http://www.cs02.com/luo40.asp"> 离 开 </a>
1<br/>
1<br/>
 1   
 2If Request.Form("log")<>1 then   
 3If trim(Request.Form("talk"))="" then   
 4' 判 断 用 户 是 否 没 有 输 入 任 何 内 容   
 5talk=Session("nick")&" 沉 默 是 金。"   
 6Else   
 7talk=trim(Request.Form("talk"))   
 8' 去 掉 字 符 后 的 空 格   
 9End If   
10  
11Application.lock   
12Application("show")="

<table border="0" cellpadding="0" cellspacing="0" width="85%"><tr><td bgcolor="#C0C0C0" width="100%"></td></tr><tr><td width="100%"><font color="#0000FF"> 来 自 "&amp;Request.ServerVariables("remote_addr")&amp;" 的 "&amp;Session("nick")&amp;time&amp;" 说:</font>"&amp;talk&amp;"</td></tr><tr><td bgcolor="#C0C0C0" width="100%"></td></tr></table>


``` "&Application("show") Application.UnLock

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

Published At
Categories with Web编程
Tagged with
comments powered by Disqus