Wrox Programmer Forums
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 4th, 2006, 06:58 AM
Authorized User
 
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default re number of logged in users.

Hi there,

I am having problems with my "how many users logged in count" most of the time when I log in to my web site with a user name and password it shows that there are 2, 3, or sometimes 7 people logged in. I know this is not correct. I have attached my code below. Can anyone suggest why?

Thanks

This is my global.asa file which is listed in my directory.

    <script language="vbscript" runat="server">
    Sub Session_OnStart
      Session("StartTime") = Now()
        Application.Lock
    Application("TotalNumberOfUsers") = _
        Application("TotalNumberOfUsers") + 1
    Application("CurrentNumberOfUsers") = _
        Application("CurrentNumberOfUsers") + 1
    Application.Unlock
    End Sub
    Sub Session_OnEnd
        Application.Lock
    Application("CurrentNumberOfUsers") = _
        Application("CurrentNumberOfUsers") - 1
    Application.Unlock
    End Sub
    Sub Application_OnStart
        Application("EMailAddress") = "malhyp@optusnet.com.au"
    End Sub
    Sub Application_OnEnd
    End Sub

    Sub Application_OnStart
    Application("iWroxPress") = 0
    Application("iWroxConf") = 0
    Application("iActivePath") = 0
    Application("iBowens") = 0
    Application("iHudson") = 0
    End Sub

    </script>

And this is my code in the page that shows after you log in, which is in my html folder.

<%=Application("CurrentNumberOfUsers")%>

Thanks.
 
Old February 4th, 2006, 10:36 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Session_Start fires for each new session. So, if you open three new browsers to the same page, you have three sessions.

The App counter keeps counting as long as the application isn't restarted...

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
getting number of users logged into the site g_vamsi_krish ASP.NET 1.0 and 1.1 Professional 6 May 26th, 2006 09:33 AM
Determine logged on users markw707 Access 1 January 21st, 2005 01:59 AM
Redirecting logged on Users fletched PHP How-To 1 March 25th, 2004 06:42 PM
Redirecting logged in users zicaden Beginning PHP 3 September 6th, 2003 02:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.