' ********* use the database to determine the online list and the number of people online
' ********* system support: asp+access, tested on WINDOWS2000+IIS5
' *********login.asp*********
<% @LANGUAGE = "VBSCRIPT"%>
<% ' on ERROR RESUME next%>
<!--#INCLUDE file= ". /fpdb/connection. ASP--
.
.
.
' Login judgment, slightly
.
.
' Login Successful
Session ("Name") =rs ("M_name")
Rs. Close
Strsql= "Update b_member Set m_isonline=yes,m_lasttime=now () Where m_name= '" +strname+ "'"
Rs. Open Strsql,myconn
Response.Redirect "Xxx.asp"
SET rs=nothing
MyConn. CLOSE
SET myconn=nothing
%>
' *********refresh.asp*******
<% @LANGUAGE = "VBSCRIPT"%>
<% ' on ERROR RESUME next%>
<!--#INCLUDE file= ". /fpdb/connection. ASP--
<meta http-equiv= "Refresh" content= "60,url=refresh.asp" >
.
.
.
' Set the 5-minute non-action ID to offline,rers1 for the previous open connection, and read the ID.
Set Rers2=server.createobject ("ADODB. RECORDSET ")
For ipage= 1 to Onlinenum
If minute (now)-minute (rers1 ("M_lasttime")) >5 or Minute (now)-minute (rers1 ("M_lasttime")) <0 Then
Resql= "Update b_member Set m_isonline=no Where m_id=" &rers1 ("m_id")
Rers2. Open Resql,myconn
End If
Rers1. MoveNext
If Rers1. EOF then Exit for
Next
Myconn.close
SET myconn=nothing
%>
' *************main.asp, the master file is judged off, preventing direct shutdown of the browser resulting in an error
<body onunload= "Javascript:window.open (' close.asp ', ' newwindow ', ' height=20, width=20, Top=0, left=0, Toolbar=no, Menubar=no, Scrollbars=no,resizable=no,location=no, Status=no ') ">
' *************close.asp, ditto **********
<% @LANGUAGE =vbscript%>
<!--#INCLUDE file= ". /fpdb/connection. ASP--
<%on ERROR RESUME NEXT
SET Rsclo=server. CreateObject ("ADODB. RECORDSET ")
strclo= "UPDATE b_member SET m_isonline=no,m_atarea= ' not online ' WHERE m_name= '" &session ("NAME") & "'"
Rsclo. Open Strclo,myconn
Rsclo. Close
MyConn. CLOSE
SET rsclose=nothing
SET myconn=nothing
Response.Write Err.Description
%>
<script language= "JavaScript" >
Window.close ();
</script>
That's basically it.