📄 online.asp
字号:
<!--#include file="conn.asp" -->
<!--#include file="inc/const.asp"-->
<%
Dim Rsonline,strUsername,statuserid,stridentity,remoteaddr,onlinemany
Dim Rs,SQL,Grades
If Request.ServerVariables("HTTP_X_FORWARDED_FOR")=empty Then
remoteaddr=Request.ServerVariables("REMOTE_ADDR")
else
remoteaddr=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
End If
If Newasp.membername="" Then
Grades = 0
strUsername ="匿名用户"
else
Grades = CInt(Newasp.membergrade)
strUsername = Newasp.membername
End If
Set Rs=Newasp.Execute("select * from NC_UserGroup where Grades = "& Grades)
stridentity = Rs("GroupName")
Rs.Close
Set Rs=Nothing
Set Rsonline = server.CreateObject ("adodb.recordset")
SQL="select * from [NC_online] where ip='"&remoteaddr&"' and username='"&strUsername&"' or id="&session.sessionid
Rsonline.Open SQL,Conn,1,3
If Rsonline.EOF Then
Rsonline.addnew
Rsonline("identity") = stridentity
Rsonline("startTime") = now()
Rsonline("lastTime") = now()
Rsonline("browser") = Request.ServerVariables("HTTP_USER_AGENT")
Rsonline("ip") = remoteaddr
Rsonline("username") = strUsername
Rsonline("id") = session.sessionid
else
Rsonline("browser") = Request.ServerVariables("HTTP_USER_AGENT")
Rsonline("lastTime") = now()
Rsonline("identity") = stridentity
Rsonline("ip") = remoteaddr
Rsonline("username") = strUsername
Rsonline("id") = session.sessionid
End If
Rsonline.update
Rsonline.close
Set Rsonline = Nothing
Rem 删除超时用户
If IsSQLDataBase = 1 Then
conn.execute("delete from [NC_online] where DateDIff(s,lastTime,GetDate()) > "& CInt(Newasp.Setting(20)) &" * 60")
else
conn.execute("delete from [NC_online] where DateDIff('s',lastTime,Now()) > "& CInt(Newasp.Setting(20)) &" * 60")
End If
onlinemany = conn.execute("Select count(id)from NC_online")(0)
If Request.Querystring("id") = 1 Then
Response.Write "document.writeln(" & chr(34) & ""& onlinemany &""& chr(34) & ");"
End If
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -