📄 online.asp
字号:
<!-- #include file="conn1.asp" -->
<!-- #include file="function.asp" -->
<!-- #include file="iXs_Ip.asp" -->
<%
dim Title_Name,CategoryName,CategoryName_CHS,username,URL,kicktime,lastimebk,address
kicktime=10
UserName=session("turename")
if UserName="" then
UserName="客人"
end if
if getip()<>"61.131.62.133" then
call sqlonline()
end if
Response.Write "document.write(" & chr(34) & "<a href=tj/ShowOnline.asp title=点击查看在线列表,你的IP:"& getip() &" target='_blank'><font color=#ffffff>当前在线</font><font color=red> "& online() &"</font><font color=#ffffff> 人 </font><font color=#ffffff>总访问</font><font color=red> "& count() &"</font><font color=#ffffff> 次</font></a>"& chr(34) & ")"
sub sqlonline()
dim statuserid,ip
ip=GetIp()
statuserid=replace(ip,".","")
address=look_IP(ip)
Response.Cookies("mesky")("onlineid")=statuserid
sql="select id,lastimebk from online where id="&statuserid&" and username='"&username&"'and ip='"&ip&"'"
set rs=conn.execute (sql)
if rs.eof and rs.bof then
sql="insert into online(id,UserName,ip,startime,lastimebk,browser,actforip,mem) values ("&statuserid&",'"&UserName&"','"&Request.ServerVariables("REMOTE_HOST")&"',now(),now(),'"&Request.ServerVariables("HTTP_USER_AGENT")&"','"&Request.ServerVariables("HTTP_X_FORWARDED_FOR")&"','"&session("mem")&"')"
else
sql="update online set lastimebk=now(),UserName='"&UserName&"',mem='"&session("mem")&"' where id="&statuserid&" and username='"&username&"'and ip='"&ip&"'"
end if
conn.execute(sql)
sql="select id,lastimebk from list where id="&statuserid&" and username='"&username&"'and ip='"&ip&"'"
set rs=conn.execute(sql)
if rs.eof and rs.bof then
sql="insert into list(id,UserName,ip,address,startime,lastimebk,times) values ("&statuserid&",'"&UserName&"','"&Request.ServerVariables("REMOTE_HOST")&"','"&address&"',now(),now(),1)"
else
lastimebk=rs("lastimebk")
sql="update list set lastimebk=now(),UserName='"&UserName&"',address='"&address&"' where id="&statuserid&" and username='"&username&"'"
if DATEDIFF("s", lastimebk, now()) > 1200 then
sql="update list set lastimebk=now(),UserName='"&UserName&"',times=times+1,address='"&address&"' where id="&statuserid&" and username='"&username&"'"
end if
end if
conn.execute sql
set rs=nothing
Rem 删除超时用户
sql="Delete FROM online WHERE DATEDIFF('s', lastimebk, now()) > "&kicktime&"*60"
Conn.Execute sql
end sub
function online()
sql="Delete FROM online WHERE DATEDIFF('s', lastimebk, now()) > "&kicktime&"*60"
Conn.Execute sql
dim tmprs
sql="Select count(id) from online"
set tmprs=conn.execute(sql)
online=tmprs(0)
set tmprs=nothing
if isnull(online) then online=0
end function
function count()
dim tmprs
sql="Select sum(times) from list"
set tmprs=conn.execute(sql)
count=tmprs(0)
set tmprs=nothing
if isnull(count) then count=0
end function
function GetIp()
dim realip,proxy
realip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
proxy = Request.ServerVariables("REMOTE_ADDR")
if realip = "" then
GetIp = proxy
else
GetIp = realip
end if
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -