标签:
‘*********login.asp*********
<%@LANGUAGE="VBSCRIPT"%>
<%‘ON ERROR RESUME NEXT%>
<!--#INCLUDE FILE="../FPDB/CONNECTION.ASP"-->
.
.
.
‘登录推断。略
.
.
‘登录成功
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"-->
<html>
<head>
<meta http-equiv="refresh" content="60,url=refresh.asp">
</head>
.
.
.
‘设置5分钟未动作的id为offline,rers1为前面打开的连接,读取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,主文件里推断关闭。防止直接关闭浏览器产生错误
<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,同上**********
<%@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=‘不在线‘ 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>
基本是这样的。
版权声明:本文博客原创文章。博客,未经同意,不得转载。
标签:
原文地址:http://www.cnblogs.com/gcczhongduan/p/4747681.html