Online and use the database to infer online

Source: Internet
Author: User


' ********* using databases to infer online lists and online numbers
' ********* system support: asp+access, tested on WINDOWS2000+IIS5

' *********login.asp*********

<% @LANGUAGE = "VBSCRIPT"%>
<% ' on ERROR RESUME next%>
<!--#INCLUDE file= ". /fpdb/connection. ASP--
.
.
.
' Login inference. 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, inferred close in the main file. Prevents 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>

This is basically the case.

Copyright notice: This article blog original article. Blogs, without consent, may not be reproduced.

Online and use the database to infer online

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.