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

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Visits Today how??
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

michaelman
Starting Member

1 Posts

Posted - 06 July 2001 :  01:25:54  Show Profile
Does anyone has the code for global.asa for Visits Today:?
I like the code to display the today of users come to the page today.

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 06 July 2001 :  01:54:33  Show Profile
This is what I have in my global.asa file: (the entire contents of it)

<OBJECT RUNAT=Server SCOPE=Session ID=MyInfo PROGID="MSWC.MyInfo">
</OBJECT>
<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>


Also see here: http://forum.snitz.com/forum/link.asp?TOPIC_ID=9410
Go to Top of Page

George_Zhu
Starting Member

China
46 Posts

Posted - 07 July 2001 :  02:23:12  Show Profile  Visit George_Zhu's Homepage
I have a table to record all the visits to my site, like some status scripts.

and use

sql = "select * from visit where visittime = '"&date()&"'"

[font color=SlateBlue]Learning is all I want[/font]
-----------------------
http://www.zhujie.org
Go to Top of Page

michaeltran
Starting Member

13 Posts

Posted - 27 July 2001 :  00:37:55  Show Profile
Richard;
On the top of this script, the lines:
 <OBJECT RUNAT=Server SCOPE=Session ID=MyInfo PROGID="MSWC.MyInfo"></OBJECT>


What does it do??When I have it on my global.asa it runs great, but on the other page I got error running it.

Then I removed it, it return whatever Number of visitings = number of visitors today.

Why???

This is the error I got:


 Active Server Pages error 'ASP 0121' 

Invalid Scope in object tag

C:\INETPUB\TULSAVBC\NHACTHANH\../global.asa, line 1

The object instance 'MyInfo' cannot have Application or Session scope. To create the object instance with Session or Application scope, place the Object tag in the Global.asa file.


Edited by - michaeltran on 27 July 2001 00:40:55
Go to Top of Page
  Previous Topic Topic Next Topic  
 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.27 seconds. Powered By: Snitz Forums 2000 Version 3.4.07