dim conn
dim connstr
connstr="DBQ="+server.mappath("**************")+";pwd=*******;DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
set rs=conn.execute("select id from online where username='"&session("username")&"' and ip='"&Request.ServerVariables("REMOTE_ADDR")&"'")
if rs.eof then
conn.execute("insert into online (logintime,username,ip) values ('"&now()&"','"&session("username")&"','"&Request.ServerVariables("REMOTE_ADDR")&"')")
else
conn.execute("update online set logintime='"&now()&"' where username='"&session("username")&"' and ip='"&Request.ServerVariables("REMOTE_ADDR")&"'")
conn.execute("update member set lasttime='"&now()&"' where username='"&session("username")&"'")
end if
rs.close
set rs=nothing
conn.execute("delete * from online where datediff('s',logintime,now())>1200")