My approach to this problem is that the user has an active interval problem. If the time interval is exceeded, it can be considered offline. The latter can log in. If there is no latter, it does not mean that the former needs to be logged in again. Because his session is still there. The smaller the time setting, the more accurate it is.
Code Post it for reference.
Function checkonline () dim IP, rsprv, SQL, prvdbstateprvdbstate = falseif dbstate = false thendbopen () prvdbstate = trueend ifset rsprv = server. createobject ("ADODB. recordset ") if SESSION (" username ") =" "thensql =" select * from [Online] Where sessionid = '"& session. sessionid & "'" rsprv. open SQL, Conn, 1, 3if rsprv. EOF thenrsprv. addnewrsprv ("sessionid") = session. sessionidrsprv ("groupchargelv") =-1 rsprv ("lastac TTime ") = now () rsprv (" userip ") = getiprsprv (" onlinetime ") = 0 rsprv (" userwhere ") = request. servervariables ("http_referer") elsersprv ("userwhere") = request. servervariables ("http_referer") rsprv ("onlinetime") = rsprv ("onlinetime") + datediff ("N", rsprv ("lastacttime"), now ()) rsprv ("lastacttime") = now () end ifrsprv. updatersprv. close () 'response. write "notlogin" else 'response. write "logined" SQL = "select * fro M [Online] Where username = '"& SESSION (" username ") &"' "rsprv. open SQL, Conn, 1, 3if rsprv. EOF thenrsprv. addnewrsprv ("sessionid") = session. sessionidrsprv ("username") = SESSION ("username") rsprv ("groupchargelv") = SESSION ("groupchargelv") rsprv ("lastacttime") = now () rsprv ("onlinetime") = 0 rsprv ("userip") = getiprsprv ("userwhere") = request. servervariables ("http_referer") elseif rsprv ("sessionid") <> sessio N. sessionid and application ("loginset") (1) = false theninfoto "loginout. ASP "," this account has been logged on elsewhere. You can set only one logon ID for one website. You can try logging on later. "Response. end () end ifrsprv ("userwhere") = request. servervariables ("http_referer") rsprv ("onlinetime") = rsprv ("onlinetime") + datediff ("N", rsprv ("lastacttime"), now ()) rsprv ("lastacttime") = now () end ifrsprv. updatersprv. close () end ifset rsprv = nothingif datediff ("S", application ("onlinelastdelete"), now ()> int (Application ("deleteonlinediff") thenapplication. lock () Application ("onlinelastdelete") = nowapplication. unlock () Conn. execute ("delete from [Online] Where datediff ('s ', lastacttime, now ()>" & int (Application ("checkonlinediff ")&"")) 'delete the end ifif prvdbstate = true then dbclose () end function of the guest that has no activity in seconds.