onlinechk.asp

来自「一个ASP做的论坛」· ASP 代码 · 共 46 行

ASP
46
字号
<%
'on error resume next
onlinefound=false
if Request.Cookies("bookbaby")("username")<>"" then
    username=Request.Cookies("bookbaby")("username")
else
    username="客人" & session.sessionid
end if
'ip=Request.ServerVariables("REMOTE_ADDR")
sex=Request.Cookies("bookbaby")("usersex")
Application.Lock
if isempty(Application("online")) then
redim online(0)
online(0)=username & "|" & stat & "|" & now() & "|" & sex
else
online=Application("online")
end if

    for i=0 to ubound(online)
	if instr(online(i),username)>0 or instr(online(i),"客人" & session.sessionid)>0 then
	    online(i)=username & "|" & stat & "|" & now() & "|" & sex
	    onlinefound=true
	    exit for
	end if
    next
if onlinefound=false then
    ReDim Preserve online(ubound(online)+1)
    online(ubound(online))=username & "|" & stat & "|" & now() & "|" & sex
end if
i=0
do while i<=ubound(online)
	onlinearr=split(online(i),"|")
	lasttime=cdate(onlinearr(2))
	where=onlinearr(1)
	    if datediff("n",lasttime,now())>15 then
		for j=i to (ubound(online)-1)
		    online(j)=online(j+1)
		next
		i=i-1
		ReDim Preserve online(ubound(online)-1)
	     end if
i=i+1
loop
Application("online")=online
Application.UnLock
'response.write err.description%>

⌨️ 快捷键说明

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