📄 delonline.asp
字号:
<!-- #include file="function.asp" -->
<!-- #include file="iXs_Ip1.asp" -->
<%
dim conn1
dim connstr1
dim db,sql11,rs11,UserName,kicktime,address
kicktime=10
UserName=session("turename")
if UserName="" then
UserName="客人"
end if
'更改数据库名字
db="./tj/tj.mdb"
Set conn1 = Server.CreateObject("ADODB.Connection")
connstr1="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn1.Open connstr1
sub delonline()
dim statuserid,ip
ip=GetIp()
statuserid=replace(ip,".","")
sql11="Delete FROM online where id="&statuserid&" and username='"&username&"'and ip='"&ip&"'"
set rs11=conn1.execute (sql11)
Conn1.Execute sql11
end sub
'==========在线用户=============
sub sqlonline()
dim statuserid,ip,lastimebk
ip=GetIp()
if ip<>"61.131.62.133" then
statuserid=replace(ip,".","")
address=look_ip(ip)
Response.Cookies("mesky")("onlineid")=statuserid
sql11="select id,lastimebk from online where id="&statuserid&" and username='"&username&"'and ip='"&ip&"'"
set rs=conn1.execute (sql11)
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
conn1.execute(sql)
sql="select id,lastimebk from list where id="&statuserid&" and username='"&username&"'and ip='"&ip&"'"
set rs=conn1.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
conn1.execute sql
set rs=nothing
end if
Rem 删除超时用户
sql="Delete FROM online WHERE DATEDIFF('s', lastimebk, now()) > "&kicktime&"*60"
Conn1.Execute sql
end sub
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 + -