📄 showuser1.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="opendb.asp" -->
<%
'在线人数统计
sessionID = session.SessionID
timeout = 5 ' set how long to keep this session in minute you can increase this number
' delete session after timeout
aaa = dateadd("n", -timeout, now())
conn.Execute ("delete * from users_online where postdate < #" & aaa & "#")
' keep sessionID
sql0 = "select sess from users_online where sess='" & sessionID & "'"
set rscheck = conn.Execute (sql0)
if rscheck.eof then
sql = "insert into users_online (sess,postdate) values('" & sessionID & "', '" & now() & "')"
conn.Execute (sql)
end if
rscheck.close
set rscheck = nothing
'count sessionID
sql2 = "select count(sess) from users_online"
set rs = conn.Execute (sql2)
count = rs(0)
rs.close
set rs = nothing
sql3 = "select * from users_online"
set rspredel = conn.Execute (sql3)
do until rspredel.eof
xxx=DateDiff("n", rspredel("postdate"), Now())
if xxx > timeout then
count = count-1
end if
rspredel.movenext
loop
rspredel.close
set rspredel = nothing
conn.Close
set conn = nothing
if count = 0 then
count = 1
end if
count=count+5 '增加10, 以5为在线基数
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="bbs.css" rel="stylesheet" type="text/css">
<meta http-equiv="refresh" content="300">
</head>
<body bgcolor="#BBDDFF" leftmargin="0" topmargin="0">
<table width="100%" border="0">
<tr>
<td align="center"><a href="http://www.cf98.com/" target="_blank">CF98</a>欢迎您!
<% If session("nickname")="" Then %>
朋友! :-)
<% Else %> <%= session("nickname") %> <% End If %> </td>
</tr>
<tr>
<td align="center">在线人数:<font color="#FF0000"><%=count%> </font></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -