标题:global.asa 问题请教
取消只看楼主
gesongs
Rank: 3Rank: 3
等 级:论坛游侠
威 望:3
帖 子:129
专家分:100
注 册:2011-7-7
结帖率:52.78%
 问题点数:0 回复次数:0 
global.asa 问题请教
实现功能是 登录后 看有多少个用户在线
session("gong_hao")  能赋值 不成功
见 下述红色 部分

<object runat="Server" scope="Application"
id="rstActiveUsers" progid="ADODB.Recordset">
</object>

<script language="VBScript" runat="Server">
Sub Application_OnStart()
Const adInteger = 3
Const adVarChar = 200
Const adDate = 7
application("gong_hao")=""

rstActiveUsers.Fields.Append "id", adInteger
rstActiveUsers.Fields.Append "ip", adVarChar, 15
rstActiveUsers.Fields.Append "browser", adVarChar, 255
rstActiveUsers.Fields.Append "started", adDate
rstActiveUsers.Open
End Sub

Sub Session_OnStart()
Session.Timeout = 20
Session("Start") = Now()

If Not rstActiveUsers.EOF Then rstActiveUsers.MoveLast
rstActiveUsers.AddNew
rstActiveUsers.Fields("id").Value = session("gong_hao")'这段代码中的 session("gong_hao")获取不到值
rstActiveUsers.Fields("ip").Value = Request.ServerVariables("REMOTE_HOST")
rstActiveUsers.Fields("browser").Value = Request.ServerVariables("HTTP_USER_AGENT")
rstActiveUsers.Fields("started").Value = Now()
rstActiveUsers.Update
 
End Sub

Sub Session_OnEnd()
Const adSearchForward = 1
Const adBookmarkFirst = 1
Const adAffectCurrent = 1

rstActiveUsers.Find "id = " & Session.SessionID,0, adSearchForward, adBookmarkFirst
If Not rstActiveUsers.EOF Then
rstActiveUsers.Delete adAffectCurrent
End If
End Sub
</SCRIPT>
搜索更多相关主题的帖子: 成功 browser 在线 用户 
2012-07-12 14:53



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-373229-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.043145 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved