comein.asp

来自「《动态网页设计基础教程》,胡杰,科学出版社」· ASP 代码 · 共 70 行

ASP
70
字号
<%
Response.buffer=true
%>
<HTML>
<HEAD>
<TITLE>聊天室</TITLE>
</HEAD>
<%
'将用户名存入数组
Items=split(application("people"),",")
'判断在线人数是否超出规定人数
If ubound(items)=1000 Then
   Response.write "人满为患,请稍后再来!"
   Session.abandon
   Response.end
End if
'如果在线人数没有超出规定人数,取得用户名
name=session("name")
Application.lock
'将用户名加入到名为people的Application变量中
Application("people")=application("people") & name & ","
Application("Onlines")=Application("Onlines") + 1
items=split(application("people"),",")
for i=0 to ubound(items)-1
Application(items(i))="你们好,我来了!" & "<BR>"
next
Application.unlock
Session("begin")=Time
%>
<%	
Dim Visitors
WhichFile=Server.mappath("count.txt")

'创建一个FileSystemObject的实例
Set fs=Server.CreateObject("Scripting.FileSystemObject")
'启动count.txt文件,并且读取记录在文件中的Visitors
Set thisfile=fs.OpenTextFile(WhichFile,,TRUE)
Visitors=thisfile.ReadLine
Thisfile.close
If IsEmpty(session("Connected")) Then
'将计数器加1
Visitors=Visitors+1
End If
Session("connected")=True
'将计数器写入count.txt文件之中
Set out=fs. CreateTextFile(WhichFile)
Out.WriteLine(Visitors)
Out.close
Set fs=nothing

session("visitors")=visitors

%>
<Frameset rows="60%,*">
<Frameset cols="70%,*">
<Frame name="ltop" target="ltop" scrolling="auto" noresize src="content.asp">
<Frame name="rtop" target="rtop" scrolling="auto" noresize src="talker.asp">
</frameset>
<Frameset cols="*">
<Frame scrolling="auto" noresize src="talking.asp">
</frameset>
</Frameset>
</HTML>






⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?