View Light

global.asa - current user counting

How Many People Are on your Site Right Now?
By Joðo Vieira

--------------------------------------------------------------------------------

I think this one is really easy, and even if you never used global.asa don't worry, just put the one I have at this page for download at the root of your page (e.g. www.yourpage.com/global.asa). If you are unfamiliar with global.asa, be sure to also check out this article on Global.asa. Now all you need is to keep track of a counter as each new user enters your page. You'll also need to decrement your counter when someone leaves, and have code to display the current count.

Explaining Application Variables
      Application variables work like session variables except that the value of Application variables are the same for all the users, and the values of session variables are different for each user. An instance of every session variable is created for every user. Only one instance of all Application variables is created when the server starts up. Hopefully with the example you will understand better.

File: Global.asa




File: main.asp
We'll,... after lots of research I made this code that show the users that are seeing your page on real-time by getting the info from the application variable...

<%
   response.write "Are Now " & Application("WhosOn") & " users at this page."
%>

Happy Programming!

Rating: (You must be logged in to vote)
Reply
Replies:
Comfortably Anonymous
12/7/2004 10:12:53 AM
0 Dislikes: 0
Comfortably Anonymous
12/7/2004 10:13:39 AM
0 Dislikes: 0