Using ASP to display the current online user information, not simply show the number of people that kind! [1]

Source: Internet
Author: User
Tungse at 00-9-3 02:35:55 in: ASP zone
Global.asa put it in your root directory.
<object runat= "Server" scope= "Application"
Id= "Rstactiveusers" progid= "ADODB. Recordset ">
</object>
<script language= "VBScript" runat= "Server" >
' The ' the ' the ' the ' the ' should notice is the top line.
' It creates an application scoped Recordset object
' Named Rstactiveusers ' I ' ll use the to store all
' Our user information.
'
' Note:i ' ve wrapped it for readability
Sub Application_OnStart ()
' Selected constants from Adovbs.inc
Const Adinteger = 3
Const adVarChar = 200
Const addate = 7

' Here I set the up in memory active user recordset
' By adding the fields I want to it and defining
' Their data types.
RstActiveUsers.Fields.Append "id", adinteger
RstActiveUsers.Fields.Append "IP", adVarChar, 15
RstActiveUsers.Fields.Append "Browser", adVarChar, 255
RstActiveUsers.Fields.Append "Started", addate
' Next I open our recordsets so ' we can use it.
' That's basically gets everything ready for our
' The ' I user.
Rstactiveusers.open
End Sub
Sub Session_OnStart ()
' Set session timeout to minutes
Session.Timeout = 20
' Set a session start time. This is pretty pointless,
' But it does ensure that we start a session and
' Assign the user a session ID with it can help
' Troubleshooting if we ever need it.
Session (' Start ') = Now ()

' Move to the ' end so records are added in order.
' Again not of ' importance, but it keeps
' User table nice and orderly.
If not rstactiveusers.eof Then rstactiveusers.movelast
' Add a record and insert users data. I ' m just
' Storing some basic info, but naturally ' re free

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.