<%  
'==============会员资料如下==================================

set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select id,name,myjb,myjy,tjj,keys,vipdj,vipdate from Users where sid='"&RequestStr(sid)&"'",conn,1,1
if rs.eof then
myid=0
myni="游客"&session.sessionid
myjb=0
myjy=0
vipdj=0
keys = 0
'==============会员初始化设置=================================
ELSE
myid=rs("id")             'ID
myni=rs("name")           '昵称
myjb=rs("myjb")           ' 币数
myjy=rs("myjy")           ' 经验
vipdj=rs("vipdj")           ' VIP等级
vipdate=rs("vipdate")           ' VIP等级
tjj=rs("tjj")              '在线时间
keys=rs("keys")            '社区管理员权限

END IF
rs.close
set rs=nothing
'=============更新在线时间====================================
DiffEnd = 100
if tjj <> "" then
  DiffEnd = DateDiff("s", tjj, NOW())
else
  tjj = (Now() - 1)
end if

IF DiffEnd >= 50 THEN
if datesql="1" then
conn.Execute("update Users set loginIP='"&User_Ip&"',tjj=now() Where id=" & myid)
else
conn.Execute("update Users set loginIP='"&User_Ip&"',tjj=getdate() Where id=" & myid)
end if
END IF
if operout<>"http://" and keys<>1 then
browsers=Lcase(Left(Request.ServerVariables("HTTP_USER_AGENT"),4))
browsers2=Lcase(Request.ServerVariables("HTTP_USER_AGENT"))

if browsers="oper"  or  browsers="winw"  or  browsers="wapi" or browsers="mc21" or browsers="up.b" or browsers="upg1" or browsers="upsi" or browsers="qwap" or browsers="jigs" or browsers="java" or browsers="alca" or browsers="wapj" or browsers="cdr/" or browsers="nec-" or browsers="fetc" or browsers="r380" or browsers="winw" or browsers="mozi" or browsers="mozi" or browsers="m3ga" OR instr(browsers2,"msie")>0 or instr(browsers2,"openwave")>0 or instr(browsers2,"oper")>0 or instr(browsers2,"winw")>0 then
response.redirect operout
end if
end if

'===============================================================

onlineip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
if onlineip="" then onlineip = Request.ServerVariables("REMOTE_ADDR")

if myid=0 then '判断用户未登录

set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select id,times,onlineip,online,name,userid from online where id="&session.sessionid&" or onlineip='"&onlineip&"'",conn,1,2
if rs.eof then
rs.addnew
end if
rs("id")=session.sessionID
rs("online")=0
rs("onlineip")=onlineip
rs("times")=now()
rs("name")="游客"&session.sessionid
rs("userid")=0
rs.update
rs.close
set rs=nothing

else
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select id,times,onlineip,online,name,userid from online where id="&session.sessionid&" or userid="&myid,conn,1,2
if rs.eof then 
rs.addnew
end if
rs("id")=session.sessionID
rs("online")=1
rs("onlineip")=onlineip
rs("times")=now()
rs("name")=myni
rs("userid")=myid
rs.update
rs.close
set rs=nothing
end If
'===============================================================
'lonline为会员离线时间
n=second(time)
If n>0 And n Mod 4=0 Then '4的倍数

if dateSQL="0" then
conn.Execute("delete from online where times <= '"&DateAdd("n", lonline, Now())&"'")
conn.Execute("delete from sqdt where shijian <= '"&DateAdd("n", "-300", Now())&"'")
else
conn.Execute("delete from online where DATEDIFF('s', times, now()) > 60*60")
conn.Execute("delete from sqdt where DATEDIFF('s', shijian, now()) > 60*300")
end If

End if
'===============================================================
%>