• home
  • forum
  • my
  • kt
  • download
  • Display Number of Users Online

    Author: 2007-07-05 09:31:10 From:

    The following ASP code will allow you to Count and Display the amount of visitors that are currently on or viewing your website.

    You will have to save this ASP code into a file called 'global.asa', which must be uploaded to the root of your webserver.

    <SCRIPT LANGUAGE="VBScript" RUNAT="Server">
    Sub Application_OnStart
    Application("strVisitors") = 0
    End Sub

    Sub Application_OnEnd
    End Sub

    Sub Session_OnStart
    Application.lock
    Application("strVisitors")=Application("strVisitors") + 1
    Application.unlock
    End Sub

    Sub Session_OnEnd
    Application.lock
    Application("strVisitors")=Application("strVisitors") - 1
    Application.unlock
    End Sub
    </SCRIPT>
     

    Place following code where you want your Active Visitor results to appear.


    <%
    'Write the amount of active visitors
    Response.Write(Application("strVisitors"))
    %>
     

    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      NET (110)

    New

    Hot