ASP 统计用户在线时间
来源:互联网 发布:烟台易云网络 编辑:程序博客网 时间:2024/04/29 10:24
原理:每个网页都包含conn.asp数据库连接页,所以把要统计的放到这个页比较好。
这样只要你打开网页,那么这个网页上就有一个隐藏的定时刷新的iframe,这个页定时的把用户的在线状态写在表里,以达到统计时间的目的
conn.asp每个页都有,所以把这个隐藏iframe加到这里
<iframe name="Detail" id="Detail" frameborder="0" hspace="0" vspace="0" src="refresh.asp" style="display:none"></iframe>
refresh.asp是定时刷新页,
<META http-equiv=refresh content=300>
<META http-equiv=Pragma content=no-cache>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<%
if session("username")<>"" then
if session("refreshtimes")<>"" then
if datedIff("n",session("refreshtimes"),Now())>1 then
'*********************************************************************
SqlDbHost="127.0.0.1" '修改实际的数据库服务器地址
SqlDbName="SqlDbName" '修改为实际的数据库名
SqlUserName="SqlUserName" '修改为实际的数据库用户名
SqlUserPass="SqlUserPass" '修改为实际的数据库密码
'*********************************************************************
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=SQLOLEDB.1; Persist Security Info=True; Data Source=" & SqlDbHost & "; Initial Catalog="&SqlDbName&"; User ID="&SqlUserName&"; Password=" & SqlUserPass
conn.Open connstr
conn.execute("update users set OnlineTimes=OnlineTimes + "&datedIff("n",session("refreshtimes"),Now())&" where username='"&session("username")&"'")
session("refreshtimes")=Now()
end if
else
session("refreshtimes")=Now()
end if
end if
%>
- ASP 统计用户在线时间
- ASP统计用户在线时间
- php实现用户在线时间统计详解
- php实现用户在线时间统计详解
- ASP.NET中在线用户统计
- 用ASP.NET实现在线用户统计
- ASP.NET中在线用户统计
- ASP.NET中在线用户统计
- 用ASP.NET实现在线用户统计
- ASP.NET中在线用户统计(C#)
- ASP.NET中在线用户统计
- ASP.NET中在线用户统计
- 用ASP.NET实现在线用户统计
- ASP.NET中在线用户统计
- ASP.NET中在线用户统计
- 用ASP.NET实现在线用户统计
- ASP.NET中在线用户统计
- ASP.NET中在线用户统计
- 操作系统桌面效果:Windows Vista VS Linux Ubuntu
- 职业,行业。industry
- javascript编程起步(一)
- 【转载】sql server中分布式 链接服务器和远程登录映射
- AfxBeginThread与CreateThread的区别
- ASP 统计用户在线时间
- HTTP 错误 403.1 禁止访问:禁止执行访问 解决方法
- SQL数据库字段类型说明
- freecap 推荐
- CSDDN特约专稿:个性化推荐技术漫谈
- javascript编程起步(二)
- 关于二叉树操作的11个算法
- 电脑一族不可不知的健康元素
- 简单常识——关于 STL 算法