Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: MOD Implementation
 Active Users Lite Code Question
 New Topic  Topic Locked
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 4

NiteOwl
Junior Member

Canada
403 Posts

Posted - 28 September 2003 :  13:04:33  Show Profile  Visit NiteOwl's Homepage
Well today is a new day, I was disappointed to see that the "Visitors Today" side of the script has not re-set, I am at over 500, (I know this is incorrect), the other two aspects do appear to be working, ie the "Active Users" and the "Highest Active User"

I have not yet been able to figure out how to compensate for the 3 hour time discrepancy, I am thinking that I should replace all the word DATE's in the script with DateAdd("h", -3, Date) but my testing does not seem to support this. Any ideas?

-=NiteOwl=-
Go to Top of Page

The Impact
Junior Member

Australia
398 Posts

Posted - 28 September 2003 :  14:17:16  Show Profile
Were you waiting for the new day to test ??

Just add more hours onto the date function so that it seems closer to the next day.

Example :
DateAdd("h", vbShortDate, +24)
That leaves 1/2 an hour 'till the next day here. As of this post though.
Go to Top of Page

NiteOwl
Junior Member

Canada
403 Posts

Posted - 28 September 2003 :  14:27:49  Show Profile  Visit NiteOwl's Homepage
Ok, does the following appear to make sence, I replace all the DATE's with the suggested string?

Application("HighestToDate") = 0
Application("TodaysDate") = DateAdd("h", vbShortDate, +24)
Application("VisitorsToday") = 0

-=NiteOwl=-

Edited by - NiteOwl on 28 September 2003 14:57:26
Go to Top of Page

The Impact
Junior Member

Australia
398 Posts

Posted - 28 September 2003 :  15:01:15  Show Profile
Replace vbShortDate with just Date as well. Put a Respose.Write at the top of your page displaying the Application("TodaysDate") and you'll get the date. Change the application variable to :
Dateadd("h", vbGeneralDate, +24)
... and you'll be able to see the time and date allowing you to change the difference and check if it's working or now.

Edited by - The Impact on 28 September 2003 15:02:41
Go to Top of Page

NiteOwl
Junior Member

Canada
403 Posts

Posted - 28 September 2003 :  15:18:25  Show Profile  Visit NiteOwl's Homepage
Like this?

Sub Application_OnStart
Application("ActiveUsers") = 0
Application("HighestToDate") = 0
Application("TodaysDate") = DateAdd("h", Date, +24)
Application("VisitorsToday") = 0
Respose.Write(Application("TodaysDate"))
End Sub

Sub Session_OnStart
Session.Timeout = 20 '## minutes
Session("Start") = Now
Application.Lock
Application("ActiveUsers") = Application("ActiveUsers") + 1

if Application("ActiveUsers") > Application("HighestToDate") then
Application("HighestToDate") = Application("HighestToDate") + 1
end if

if Application("TodaysDate") = DateAdd("h", Date, +24) then
Application("VisitorsToday") = Application("VisitorsToday") + 1
else
Application("TodaysDate") = DateAdd("h", Date +24)
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

-=NiteOwl=-
Go to Top of Page

The Impact
Junior Member

Australia
398 Posts

Posted - 28 September 2003 :  15:31:12  Show Profile
Yeh, I think that should work. Just change the difference to + 3 since that is the actual time we want and all Dates to vbGeneralDate.

This will display the time as well when we Response.Write it.

If it doesn't work just add the Response.Write into your config.asp file near the bottom.
Go to Top of Page

NiteOwl
Junior Member

Canada
403 Posts

Posted - 28 September 2003 :  16:48:21  Show Profile  Visit NiteOwl's Homepage
I am working with a global.asa file here and I just found the following;

In the global.asa you can tell the application and session objects what they should do when they start and end. These instructions are placed into what are called event handlers. There are four such event handlers supported in global.asa. They're named based on their functions so logically enough they are: Application_OnStart, Application_OnEnd, Session_OnStart, and Session_OnEnd. These subroutines can contain most any asp code you want them to with a few exceptions. For example you can't use Response.Write because since global.asa is never called by a browser it naturally doesn't return anything to the browser.

-=NiteOwl=-
Go to Top of Page

The Impact
Junior Member

Australia
398 Posts

Posted - 28 September 2003 :  17:07:18  Show Profile
Yeah, so try the Response.Write in the inc_header.asp, maybe next to active users script we originally added.
Go to Top of Page

NiteOwl
Junior Member

Canada
403 Posts

Posted - 28 September 2003 :  17:44:16  Show Profile  Visit NiteOwl's Homepage
eh, good idea!

inc_header.asp
Ok I tried to use Respose.Write(Application("TodaysDate")) but it did not work, I editied to the following Application("TodaysDate") and this is the full line:
" <font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>Here is a date: " & Application("TodaysDate") & " " & "</font><br>" & vbNewLine & _
result. . .

Active Users: 4 / Visits Today: 67
Highest Active Users: 6
Here is a date: 9/28/2003
______________________________________________________________________

Now in the Global.asa I am getting very mixed up and obviously a little over my head, I am currently working with this:

Sub Application_OnStart

Application("ActiveUsers") = 0
Application("HighestToDate") = 0
Application("TodaysDate") = DateAdd("h", Date, +24)
Application("VisitorsToday") = 0
End Sub

Sub Session_OnStart
Session.Timeout = 20 '## minutes
Session("Start") = Now
Application.Lock
Application("ActiveUsers") = Application("ActiveUsers") + 1

if Application("ActiveUsers") > Application("HighestToDate") then
Application("HighestToDate") = Application("HighestToDate") + 1
end if

if Application("TodaysDate") = Dateadd("h", vbGeneralDate, +3) then
Application("VisitorsToday") = Application("VisitorsToday") + 1
else
Application("TodaysDate") = Dateadd("h", vbGeneralDate, +3)
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

_________________________________________________________________

As you can see above my DEVelopment board is showing a lot of users for this day, well that number is not correct, it appears the DATE never re-set at midnight or at 3am which is the time difference from me.

-=NiteOwl=-

Edited by - NiteOwl on 28 September 2003 18:22:57
Go to Top of Page

The Impact
Junior Member

Australia
398 Posts

Posted - 28 September 2003 :  18:15:01  Show Profile
I think I've got the problem. The script is adding three straight hours and rounding off the minutes.

I'll get back to you once I've got a solution.

Edited by - The Impact on 28 September 2003 18:16:16
Go to Top of Page

The Impact
Junior Member

Australia
398 Posts

Posted - 28 September 2003 :  18:35:45  Show Profile
Gottcha problem ! Replace your global.asa with this, I have made changes which appear in red.
Sub Application_OnStart

Application("ActiveUsers") = 0
Application("HighestToDate") = 0
Application("TodaysDate") = DateAdd("h",3,Now())
Application("VisitorsToday") = 0
End Sub

Sub Session_OnStart
Session.Timeout = 20 '## minutes
Session("Start") = DateAdd("h",3,Now())
Application.Lock
Application("ActiveUsers") = Application("ActiveUsers") + 1

if Application("ActiveUsers") > Application("HighestToDate") then
Application("HighestToDate") = Application("HighestToDate") + 1
end if

if Application("TodaysDate") = DateAdd("h",3,Now()) then
Application("VisitorsToday") = Application("VisitorsToday") + 1
else
Application("TodaysDate") = DateAdd("h",3,Now())
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
And that should be it, give it a try !

As I said the date add fuunction wasn't adding properly. I've tested that function on my server and it appears to work fine !
Go to Top of Page

NiteOwl
Junior Member

Canada
403 Posts

Posted - 28 September 2003 :  20:14:04  Show Profile  Visit NiteOwl's Homepage
I have applied the changes to my test site and it looks pretty darn good!! Its now on my production site and we will see at midnight how it all works, thanks The Impact as I know you have spent considerable time on this, I hope I will be able to do you the same one day.

-=NiteOwl=-
Go to Top of Page

The Impact
Junior Member

Australia
398 Posts

Posted - 28 September 2003 :  20:20:33  Show Profile
Glad to hear that those changes have worked ! Glad to be of help to you !

Good luck on your site's launch. Drop me a line if you have any other problems.
Go to Top of Page

NiteOwl
Junior Member

Canada
403 Posts

Posted - 28 September 2003 :  20:54:46  Show Profile  Visit NiteOwl's Homepage
I just noticed that the Visits today is not increasing on my site, any other suggestions? grin

Active Users: 21 / Visits Today: 1
Highest Active Users: 21

-=NiteOwl=-
Go to Top of Page

The Impact
Junior Member

Australia
398 Posts

Posted - 28 September 2003 :  21:07:34  Show Profile
I think I can see the problem. Now() returns a full Date and Time so when it checks it with today's date because the server start and date and time were different times it makes Visitors Today = 1.
Sub Application_OnStart

Application("ActiveUsers") = 0
Application("HighestToDate") = 0
Application("TodaysDate") = DateAdd("h",3,vbShortDate)
Application("VisitorsToday") = 0
End Sub

Sub Session_OnStart
Session.Timeout = 20 '## minutes
Session("Start") = DateAdd("h",3,Now())
Application.Lock
Application("ActiveUsers") = Application("ActiveUsers") + 1

if Application("ActiveUsers") > Application("HighestToDate") then
Application("HighestToDate") = Application("HighestToDate") + 1
end if

if Application("TodaysDate") = DateAdd("h",3,vbShortDate) then
Application("VisitorsToday") = Application("VisitorsToday") + 1
else
Application("TodaysDate") = DateAdd("h",3,vbShortDate)
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
Sorry that problem was my fault.
Go to Top of Page
Page: of 4 Previous Topic Topic Next Topic  
Previous Page | Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.3 seconds. Powered By: Snitz Forums 2000 Version 3.4.07