|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
想法是和程序员的想法不一样的.至于为什么.大家去想一想.跟心理学有关的显现|在线原东子
global.asa放在你的根目次
<objectrunat="Server"scope="Application"
id="rstActiveUsers"progid="ADODB.Recordset">
</object>
<scriptlanguage="VBScript"runat="Server">
Thefirstthingyoushouldnoticeisthetopline.
Itcreatesanapplicationscopedrecordsetobject
namedrstActiveUsersthatIllusetostoreall
ouruserinformation.
Note:Ivewrappeditforreadability
SubApplication_OnStart()
Selectedconstantsfromadovbs.inc
ConstadInteger=3
ConstadVarChar=200
ConstadDate=7
HereIsetupinmemoryactiveuserrecordset
byaddingthefieldsIwanttoitanddefining
theirdatatypes.
rstActiveUsers.Fields.Append"id",adInteger
rstActiveUsers.Fields.Append"ip",adVarChar,15
rstActiveUsers.Fields.Append"browser",adVarChar,255
rstActiveUsers.Fields.Append"started",adDate
NextIopenourrecordsetsothatwecanuseit.
Thatbasicallygetseverythingreadyforour
firstuser.
rstActiveUsers.Open
EndSub
SubSession_OnStart()
Setsessiontimeoutto20minutes
Session.Timeout=20
Setasessionstarttime.Thisisprettypointless,
butitdoesensurethatwestartasessionand
assigntheuserasessionidanditcanhelp
troubleshootingifweeverneedit.
Session("Start")=Now()
Movetotheendsorecordsareaddedinorder.
Againnotofanyrealimportance,butitkeepsour
usertableniceandorderly.
IfNotrstActiveUsers.EOFThenrstActiveUsers.MoveLast
Addarecordandinsertusersdata.Imjust
storingsomebasicinfo,butnaturallyyourefree
tostorewhateveryouwant.
rstActiveUsers.AddNew
rstActiveUsers.Fields("id").Value=_
Session.SessionID
rstActiveUsers.Fields("ip").Value=_
Request.ServerVariables("REMOTE_HOST")
rstActiveUsers.Fields("browser").Value=_
Request.ServerVariables("HTTP_USER_AGENT")
rstActiveUsers.Fields("started").Value=_
Now()
rstActiveUsers.Update
Nowthatwevegottheinformation,allthats
leftistodisplayit.Seetest_page.aspfora
demo.Itincludesthepagesshow_count.aspand
show_users.aspwhichcanalsobeused
individuallyifdesired.
EndSub
SubSession_OnEnd()
Selectedconstantsfromadovbs.inc
ConstadSearchForward=1
ConstadBookmarkFirst=1
ConstadAffectCurrent=1
Findtheappropriaterecord.Usingsessionidisthe
easiestwaysinceIusethisastheprimarykey.
Thislinepositionsusontheappropriaterecord.
rstActiveUsers.Find"id="&Session.SessionID,_
0,adSearchForward,adBookmarkFirst
问题是他们究竟是喜欢他们是使用软件时,速度快还是速度慢好.(当然在3秒以内).无论是他们输入资料时,查找资料时,分析资料时. |
|