Author |
Topic  |
|
nylemrak
Starting Member
USA
30 Posts |
Posted - 14 September 2000 : 12:47:46
|
I guess its time to share <img src=icon_smile_blush.gif border=0 align=middle>
Here's the code for: 1. Knowing how many people are currently viewing your site using global.asa 2. and a counter using global.asa
Copy and paste the following in notepad. Make sure your extension is .asa <SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart Application("Active") = 0 Application("NumberofHits") = 0 End Sub
Sub Application_OnEnd 'nothing needed here for this example End Sub
Sub Session_OnStart Session.Timeout = 5 Session("Start") = Now Application.lock Application("Active") = Application("Active") + 1 'add 1 to active visitor count when new visitor arrives Application("NumberofHits") = Application("NumberofHits") + 1 Application.unlock End Sub
Sub Session_OnEnd Application.lock Application("Active") = Application("Active") - 1 'subtract 1 active visitor when visitor leaves Application.unlock End Sub
</SCRIPT>
On your HTML use the following tags to incorporate the global application: 1. Active Visitors : You are one of<b> <%=Application("Active")%> </b>current visitors. 2: Counter You are visitor #<% = Application("NumberofHits")%>
Demo: http://24.160.56.133/forums
PS: I'm assuming you're not running any other global based applications with this settings. If so, please make sure that you consider session.timeout configurations.
*********** kay bentain
Edited by - nylemrak on 14 September 2000 13:07:22
Edited by - nylemrak on 15 September 2000 17:12:01 |
|
brkonthru
Development Team Member

Jordan
69 Posts |
Posted - 14 September 2000 : 18:12:45
|
the session.timeout has been set for a very low number. Just thought its something worth mentioning
|
 |
|
nylemrak
Starting Member
USA
30 Posts |
Posted - 15 September 2000 : 00:49:29
|
Correct me if i'm wrong but that would reflect more accurate count on current site visitors..especially when u refresh.. and server res wouldnt be eaten much..am i right or not?
prolly if you're running ADO connections via global.asa session.timeout shouldn't be that low...otherwise if you got slow posters like me..by the time they hit -post my topic-..session already timed out, ergo no db connections. post gone bye bye <img src=icon_smile_sad.gif border=0 align=middle>
*********** kay bentain
Edited by - nylemrak on 15 September 2000 00:50:48 |
 |
|
gor
Retired Admin
    
Netherlands
5511 Posts |
Posted - 15 September 2000 : 01:17:40
|
Starting a session over and over again also has implications when you use session variables to i.e. store admin-access and costs considerable resources when used with more than a few users.
<b>Pierre Gorissen </b><img src="http://www.homepages.hetnet.nl/~pgoris01/burnout.gif" border=0> <font color=purple><font size=1>A fool learns from experience... a wise man learns from others...</font id=size1></font id=purple> |
 |
|
Lord Maverick
New Member

Norway
92 Posts |
Posted - 15 September 2000 : 03:34:20
|
FYI,
This code has already been posted on this forum. Take a look at this thread
The difference in the new code is that this has also included a counter for NumberofHits.
Edited by - Lord Maverick on 15 September 2000 03:35:35
Edited by - davemaxwell on 15 September 2000 07:51:58 |
 |
|
Lord Maverick
New Member

Norway
92 Posts |
Posted - 15 September 2000 : 03:38:00
|
Hmmm, this is strange.
My last post also included this at the end:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote> The difference in the new code is that this has also included a counter for NumberofHits.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
But that doesn't show in the post. Something wrong with the Snitz forum?
|
 |
|
davemaxwell
Access 2000 Support Moderator
    
USA
3020 Posts |
Posted - 15 September 2000 : 07:52:54
|
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote> Hmmm, this is strange.
My last post also included this at the end:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote> The difference in the new code is that this has also included a counter for NumberofHits.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
But that doesn't show in the post. Something wrong with the Snitz forum?
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
All better!! You had an extra "] before the word thread which was throwing off the URL conversion....
Dave Maxwell -------------- When's the next meeting of Snitzaholics Anonymous<img src=icon_smile_question.gif border=0 align=middle> |
 |
|
Lord Maverick
New Member

Norway
92 Posts |
Posted - 15 September 2000 : 08:20:13
|
Thnx davemaxwell,
That cleared up things!
|
 |
|
brkonthru
Development Team Member

Jordan
69 Posts |
Posted - 15 September 2000 : 14:01:48
|
When setting the session.timeout property in the global.asa file, you have to remember that it sets it for the whole website or application which the global.asa is sitting in. So if you have some other script that uses sessions, you dont want that session to expire in five minutes, it is very annoying for the user.
P.S I really hope that you dont put your ADO connection in the session variable!!
|
 |
|
davemaxwell
Access 2000 Support Moderator
    
USA
3020 Posts |
Posted - 19 September 2000 : 08:34:28
|
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote> Thnx davemaxwell, <hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
No problem....
Dave Maxwell -------------- When's the next meeting of Snitzaholics Anonymous<img src=icon_smile_question.gif border=0 align=middle> |
 |
|
|
Topic  |
|