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

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Easy Active Users Mod
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

aecio
Junior Member

Brazil
120 Posts

Posted - 07 December 2001 :  21:51:35  Show Profile  Visit aecio's Homepage
I propose a different approach to the Active Users Mod. In this mod, no database is used. Instead, since we are talking ASP here, I test how many active sessions on the server at any given moment. This is accomplished with two small modifications of two files:

First, add code to the Global.asa file in the root of your site, as such:

In the SUB Session_OnStart section, add:


Application.Lock
Application("ActiveUsers") = Application("ActiveUsers") + 1
Application.Unlock


And on the SUB Session_OnEnd section, add:

Application.Lock
Application("ActiveUsers") = Application("ActiveUsers") - 1
Application.Unlock


Second, modify the default.asp file and add a line to report the Active Users at the current moment. I inserted this code in line 800, right after this code:

Response.Write "</font>" & vbNewline & _
" </td>" & vbNewline & _
" </tr>" & vbNewline

Here is the code do insert:

'###### START OF ACTIVE USERS by Aecio Lemos #####
Response.Write " <tr>" & vbNewline & _
" <td bgcolor=""" & strForumCellColor & """ colspan=""" & sGetColspan(6,5) &_
"""><font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>" & vbNewline
Response.Write "*There is/are currently " & Application("ActiveUsers") & " user(s) online."
Response.Write "</font>" & vbNewline & _
" </td>" & vbNewline & _
" </tr>" & vbNewline
'##### END OF ACTIVE USERS by Aecio Lemos #####


That's it! Working example: http://www.xsaude.com.br/ and click on English. Check the stats on the All Forums page.


Cheers!

Kenno
Average Member

Cambodia
846 Posts

Posted - 07 December 2001 :  22:29:08  Show Profile  Visit Kenno's Homepage
That works, but it lacks the feature that tell who those active users really are. For example, the one that we've had so far will tell the name of the members, or just guest.

In these days of computer viruses, asking if you may put your disk into someone's computer is the technological equivalent of unsafe sex.
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 07 December 2001 :  22:41:02  Show Profile
we've been using something similiar for quite awhile now on this site:

http://forum.snitz.com (near the top)


Right now it says:

Active Users: 28  Visits Today: 409
Highest Active Users: 770
Go to Top of Page

aecio
Junior Member

Brazil
120 Posts

Posted - 07 December 2001 :  22:43:52  Show Profile  Visit aecio's Homepage
Oh well,

As they say, Geniuses Think Alike! Hahahaha

Yes, it is a very simple alternative, but easy to use.



Cheers!
Go to Top of Page

bjlt
Senior Member

1144 Posts

Posted - 08 December 2001 :  00:39:55  Show Profile
quote:

That works, but it lacks the feature that tell who those active users really are. For example, the one that we've had so far will tell the name of the members, or just guest.

In these days of computer viruses, asking if you may put your disk into someone's computer is the technological equivalent of unsafe sex.



in sql, can we use a sql active session instead? then we know who are active. however, access do not support this and it won't show where they are.

Go to Top of Page

bjlt
Senior Member

1144 Posts

Posted - 08 December 2001 :  00:44:27  Show Profile
quote:

we've been using something similiar for quite awhile now on this site:

http://forum.snitz.com (near the top)


Right now it says:

Active Users: 28  Visits Today: 409
Highest Active Users: 770




then how do you get visits today and highest AU? I'm not good at asa file and like to follow the Snitz standard.

thanks.

Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 08 December 2001 :  07:44:24  Show Profile
Here is the contents of the global.asa file:

<SCRIPT LANGUAGE="VBScript" RUNAT="Server">

Sub Application_OnStart
Application("ActiveUsers") = 0
Application("HighestToDate") = 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("ActiveUsers") > Application("HighestToDate") then
Application("HighestToDate") = Application("HighestToDate") + 1
end if
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>


Here is what the code looks like that is on the front page of this forum:

<%
'## BEGIN Active Users CODE
Response.Write " <font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>Active Users: " & Application("ActiveUsers") & " Visits Today: " & Application("VisitorsToday") & "</font><br>" & vbCrLf
Response.Write " <font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>Highest Active Users: " & Application("HighestToDate") & " " & "</font><br>" & vbCrLf
'## END Active Users CODE
%>
Go to Top of Page

aecio
Junior Member

Brazil
120 Posts

Posted - 08 December 2001 :  15:03:03  Show Profile  Visit aecio's Homepage
Yeah, this is definitely better than what I have. In fact, just implemented it :0)

There is another version of this somewhere (I'll try to find it) that even tells which page the users are on.


Cheers!
Go to Top of Page

jenljl
Starting Member

21 Posts

Posted - 09 December 2001 :  02:25:35  Show Profile
quote:

There is another version of this somewhere (I'll try to find it) that even tells which page the users are on.



If you happen to find that, could you post it here? I'm interested in getting it.

Go to Top of Page

Ez4arab
Junior Member

479 Posts

Posted - 09 December 2001 :  05:13:27  Show Profile  Visit Ez4arab's Homepage
i made file of global.asa and i post the below code in the inc_top.asp

also i made global.asa [READ - WRITE - EXECUTE - DELETE] but the # is not shown

Arabic snit fourm
http://aljish.com.sa/jforum
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 09 December 2001 :  05:26:39  Show Profile
The global.asa file needs to be in your root web directory.
Go to Top of Page

Ez4arab
Junior Member

479 Posts

Posted - 09 December 2001 :  06:31:15  Show Profile  Visit Ez4arab's Homepage
i have file forum where my files there
do you mean i make file name it (root) the i will put the global.asa in this file

Arabic snit fourm
http://aljish.com.sa/jforum
Go to Top of Page

aecio
Junior Member

Brazil
120 Posts

Posted - 09 December 2001 :  11:05:19  Show Profile  Visit aecio's Homepage
Hi aljish,

The global.asa file must be in the root of your site. The root is the top level directory. For example, on my server, I have

C:\Inetpub\wwwroot\

and that is where my site is. When I type www.mysite.com it will show what is in the wwwroot folder. The forum is below this:

C:\Inetpub\wwwroot\forum\

The global.asa needs to be in the top level, in this case the

C:\Inetpub\wwwroot\

If you put it anywhere else, the system will not find it or use it.



Cheers!
Go to Top of Page

SimonT
Junior Member

United Kingdom
202 Posts

Posted - 08 February 2002 :  19:20:54  Show Profile
At my host they keep restarting the server maybe 2 or 3 times a week
in the morning I see my nice stats then later they are all lost is there any way to have these stats loged in a database or txt file ?
as I want to see if I can get my active usrer count over the 38 active users I once had

SimonT

I so wish I could code in ASP..
Go to Top of Page

GauravBhabu
Advanced Member

4288 Posts

Posted - 08 February 2002 :  19:32:10  Show Profile
You can use the same concept as in Mod USER Log to write it to text file. But will require fully enabled FSO on the server

www.forumSquare.com - GauravBhabu - It is difficult to IMPROVE on Perfection, There is no harm in Keep Trying.
Go to Top of Page

Raichelle
Junior Member

370 Posts

Posted - 09 February 2002 :  11:52:44  Show Profile
I already have something else on my global.asa file for my flash chat
how can i include that code richard posted for both my flash chat to work and also that showing? this is the code i have on global.asa now





<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Session_OnStart
'Set session variable for virtual-directory test
Session("ChatInitialised")=True
End Sub

Sub Session_OnEnd
Dim vChatName, vChatUsers, vChatMoods, vUserCount
Dim vRoomNo
Dim m, n

vRoomNo = Session("RoomNo")
vChatName = "" & Session("ChatName")
If vChatName <> "" Then
Application.Lock
vUserCount = CLng(Application("UserCount" & vRoomNo))
If vUserCount < 2 Then
vChatUsers = ""
vChatMoods = ""
vUserCount = 0
Else
vChatUsers = Application("ChatUsers" & vRoomNo)
vChatMoods = Application("ChatMoods" & vRoomNo)
For n = 0 To vUserCount - 1
If vChatUsers(n) = vChatName Then
For m = n To vUserCount - 2
vChatUsers(m) = vChatUsers(m+1)
vChatMoods(m) = vChatMoods(m+1)
Next
vUserCount = vUserCount - 1
Redim Preserve vChatUsers(vUserCount)
Redim Preserve vChatMoods(vUserCount)
Exit For
End If
Next
End If
Application("ChatUsers" & vRoomNo) = vChatUsers
Application("ChatMoods" & vRoomNo) = vChatMoods
Application("UserCount" & vRoomNo) = vUserCount
AddLineToChat vRoomNo, "**" & vChatName & " has left (timed out)**"
Session("ChatName") = ""
If vUserCount = 0 Then
Application("ChatLines" & vRoomNo) = ""
Application("ChatLineCount" & vRoomNo) = 0
Application("ChatMaxLines" & vRoomNo) = 0
End If
Application.Unlock
End If

End Sub

Sub AddLineToChat (ByVal vRoomNo, ByVal vNewLine)

Dim vCurrentLine, vChatLines, vMaxLines

vCurrentLine = Application("ChatLineCount" & vRoomNo)
vChatLines = Application("ChatLines" & vRoomNo)
vMaxLines = Application("ChatMaxLines" & vRoomNo)
vCurrentLine = vCurrentLine + 1
If vCurrentLine > vMaxLines Then
vMaxLines = vMaxLines + 500
If vCurrentLine = 1 Then
Redim vChatLines(vMaxLines)
Else
Redim Preserve vChatLines(vMaxLines)
End If
Application("ChatMaxLines" & vRoomNo) = vMaxLines
End If
vChatLines(vCurrentLine - 1) = vNewLine
Application("ChatLines" & vRoomNo) = vChatLines
Application("ChatLineCount" & vRoomNo) = vCurrentLine

End Sub
</SCRIPT>



Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
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.21 seconds. Powered By: Snitz Forums 2000 Version 3.4.07