Author |
Topic |
|
wedont
Junior Member
Canada
344 Posts |
Posted - 07 August 2001 : 13:51:13
|
I got the script here from Snitz, thought I got it right but it doesn't work ( no values displayed) My "host" tells me that it's a coding error! Just spent a couple hours to figure it out but to no avail!
here's the global.asa file: <SCRIPT LANGUAGE="VBScript" RUNAT="Server"> Sub Application_OnStart Application("ActiveUsers") = 0 Application("TodaysDate") = Date Application("VisitorsToday") = 0 End Sub Sub Session_OnStart Session.Timeout = 20 ' minutes Session("Start") = Now Application.Lock Application("ActiveUsers") = Application("ActiveUsers") + 1 if Application("TodaysDate") = Date then Application("VisitorsToday") = Application("VisitorsToday") + 1 else Application("TodaysDate") = Date Application("VisitorsToday") = 1 end if Application.UnLock End Sub Sub Session_OnEnd ' Decrease the active visitors count when the session ends. Application.Lock Application("ActiveUsers") = Application("ActiveUsers") - 1 Application.UnLock End Sub </SCRIPT>
And here's the "call" from an asp page:
<p align="center"><%Response.Write "Active Users: " & Application("ActiveUsers") &" Visits Today: " & Application("VisitorsToday") %></p>
Any clues?
Thanks,
Wedont The proud owner of a vintage: snitz ver3.1 sr2 access 2k. |
|
OneWayMule
Dev. Team Member & Support Moderator
Austria
4969 Posts |
Posted - 07 August 2001 : 17:29:37
|
Hmmm... I'd say your host doesn't support a global.asa...
I can't find any coding error (is this the script provided by Richard?).
|
|
|
wedont
Junior Member
Canada
344 Posts |
Posted - 07 August 2001 : 18:35:22
|
Yes,yes !
My host (readyhosting) claims to support global.asa I put it in the root of a subweb, they said I could do that. And after sending the code (as 'is' on this post)they answered that it was a "coding error" ! And that's out of their "scope" ! (I don't blaim them!)
and yes it's from richard! but I noticed that the "post" he refers to is slightly different:
<SCRIPT LANGUAGE="VBScript" RUNAT="Server"> Sub Application_OnStart Application("ActiveUsers") = 0 Application("TodaysDate") = Date End Sub Sub Session_OnStart If Application("VisitorsToday") = "" then Application("VisitorsToday") = 0 end if Session.Timeout = 10 ' minutes Session("Start") = Now Application.Lock Application("ActiveUsers") = Application("ActiveUsers") + 1 if Application("TodaysDate") = Date then Application("VisitorsToday") = Application("VisitorsToday") + 1 else Application("TodaysDate") = Date Application("VisitorsToday") = 1 end if Application.UnLock End Sub Sub Session_OnEnd ' Decrease the active visitors count when the session ends. Application.Lock Application("ActiveUsers") = Application("ActiveUsers") - 1 Application.UnLock End Sub </SCRIPT>
Wedont The proud owner of a vintage: snitz ver3.1 sr2 access 2k. |
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 07 August 2001 : 23:26:12
|
I don't know if it matters, but I always add the parentheses on function calls. I know that if you leave them out in some InterDev DTC's you can get wierd results.
Sample: Application("TodaysDate") = Date()
I have a utility at www.pe.net/~dgorin/snitz/ that shows the application, session & server variables. I get good results by puttin a link in a page to open the utility in a new window.
====== Doug G ====== |
|
|
mafifi
Junior Member
USA
308 Posts |
Posted - 08 August 2001 : 12:49:04
|
Hmmm!!! I'm using the same code and hosting with "Readyhosting" and my site http://www.media-2000.com/forum/ and it seems to work just fine.
Thanks,
Mo |
|
|
work mule
Senior Member
USA
1358 Posts |
Posted - 08 August 2001 : 14:06:41
|
I'm not sure if this would have anything to do with it, but I'm thinking that the Application_OnStart can't be kicked off until the virtual server is restarted. So if the Application variables don't exist, would that cause problems with the rest of the script? Probably not, huh?
The Work Mule Forums The Writer Community
|
|
|
mafifi
Junior Member
USA
308 Posts |
Posted - 08 August 2001 : 18:28:11
|
Here is my Global.asa file and it works fine on Readyhosting.
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Application_OnStart Application("ActiveUsers") = 0 Application("TodaysDate") = Date
End Sub
Sub Session_OnStart If Application("VisitorsToday") = "" then Application("VisitorsToday") = 0 end if Session.Timeout = 10 ' minutes Session("Start") = Now Application.Lock Application("ActiveUsers") = Application("ActiveUsers") + 1 if Application("TodaysDate") = Date then Application("VisitorsToday") = Application("VisitorsToday") + 1 else Application("TodaysDate") = Date Application("VisitorsToday") = 1 end if Application.UnLock End Sub
Sub Session_OnEnd ' Decrease the active visitors count when the session ends. Application.Lock Application("ActiveUsers") = Application("ActiveUsers") - 1 Application.UnLock End Sub
</SCRIPT>
Thanks,
Mo |
|
|
wedont
Junior Member
Canada
344 Posts |
Posted - 08 August 2001 : 21:09:17
|
Thanks every one, Mafifi, I'm trying your script, Just gonna find out tomorow! when the server's reboot will be done!(midnight as far as I know for readyhosting !)
Thanks
Wedont The proud owner of a vintage: snitz ver3.1 sr2 access 2k. |
|
|
|
Topic |
|