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!

Reply
Replies:
Comfortably Anonymous
12/7/2004 10:12:53 AM
Comfortably Anonymous
12/7/2004 10:13:39 AM
This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available in our efforts to advance understanding of environmental, political, human rights, economic, democracy, scientific, and social justice issues, etc. We believe this constitutes a 'fair use' of any such copyrighted material as provided for in section 107 of the US Copyright Law. In accordance with Title 17 U.S.C. Section 107, the material on this site is distributed without profit to those who have expressed a prior interest in receiving the included information for research and educational purposes. For more information go to: http://www.law.cornell.edu/uscode/17/107.shtml . If you wish to use copyrighted material from this site for purposes of your own that go beyond 'fair use', you must obtain permission from the copyright owner.