Results 1 to 2 of 2

Thread: How many users online?

  1. #1
    Join Date
    May 2006
    Posts
    259
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default How many users online?

    Create a text file and save it as global.asa and place the following code into it:


    <SCRIPT LANGUAGE="VBScript" RUNAT="Server">

    Sub Application_OnStart
    ' Set our user count to 0 when we start the server
    Application("users") = 0
    End Sub

    Sub Session_OnStart
    ' Change Session Timeout to 20 minutes (if you need to)
    Session.Timeout = 20
    ' Set a Session Start Time
    ' This is only important to assure we start a session
    Session("Start") = Now
    ' Increase the active visitors count when we start the session
    Application.Lock
    Application("users") = Application("users") + 1
    Application.UnLock
    End Sub

    Sub Session_OnEnd
    ' Decrease the active visitors count when the session ends.
    Application.Lock
    Application("users") = Application("users") - 1
    Application.UnLock
    End Sub

    </SCRIPT>

    Then in your webpage add the following:

    There are
    <%
    Response.Write(Application("users"))
    %>
    "Only dead fish flow with the stream".
    - Unknown

  2. #2
    Join Date
    May 2006
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Cool beans. Thanks.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •