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)
 Show active users browsing WEBSITE on page
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

SubKamran
Junior Member

101 Posts

Posted - 29 April 2002 :  19:05:10  Show Profile  Visit SubKamran's Homepage  Send SubKamran an AOL message  Send SubKamran a Yahoo! Message
How can i show people browsing my site? like this:

There are 3 people browsing this site...

Just a simple thing like that. How?

Kamran A
14/m/mn
Minneapolis, MN
Web Dev/Flash Dev

redbrad0
Advanced Member

USA
3725 Posts

Posted - 29 April 2002 :  19:11:31  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
you would need to use the global.asa file (if your host supports it). you can look on asp101.com to find out how the global.asa file works, and i think they even have a sample on how to do this.

Brad
Web Hosting with SQL Server @ $24.95 per month
Go to Top of Page

SubKamran
Junior Member

101 Posts

Posted - 01 May 2002 :  19:06:46  Show Profile  Visit SubKamran's Homepage  Send SubKamran an AOL message  Send SubKamran a Yahoo! Message
Nope...none.

Is there a way to count sessions?

The active users MOD uses the database doesn't it? I would like to use a simple way...

Kamran A
14/m/mn
Minneapolis, MN
Web Dev/Flash Dev
Go to Top of Page

SubKamran
Junior Member

101 Posts

Posted - 01 May 2002 :  19:21:47  Show Profile  Visit SubKamran's Homepage  Send SubKamran an AOL message  Send SubKamran a Yahoo! Message
Nevermind...had to look more...

THANKS!

Kamran A
14/m/mn
Minneapolis, MN
Web Dev/Flash Dev
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 01 May 2002 :  20:09:42  Show Profile  Send ruirib a Yahoo! Message
Well, I thought you were asking for something from Nathan's and I didn't even look. Here is some code to put in global asa:

<SCRIPT LANGUAGE="VbScript" RUNAT="Server">
Sub Application_OnStart()
Application("Visit_Count") = 0

End Sub

Sub Session_OnStart()
Dim intVisits

Application.Lock
intVisits = Application("Visit_Count") + 1
Application("Visit_Count") = intVisits
Application.Unlock

Session.Timeout = 15 'sets session timeout for 15 minutes
End Sub

Sub Session_OnEnd()
Dim intVisits

Application.Lock
intVisits = Application("Visit_Count") - 1
If intVisits > 0 Then
Application("Visit_Count") = intVisits
Else
Application("Visit_Count") = 0
End If
Application.Unlock

End Sub
</SCRIPT>


To get the number of visitors you just do

Response.Write Session.Contents("Visit_Count")



-------------------------------------------------
Installation Guide | Do's and Dont's | MODs


Edited by - ruirib on 01 May 2002 20:14:21
Go to Top of Page

SubKamran
Junior Member

101 Posts

Posted - 01 May 2002 :  22:41:29  Show Profile  Visit SubKamran's Homepage  Send SubKamran an AOL message  Send SubKamran a Yahoo! Message
I got it to work...but, I want it to end the session on browser close...

that way it'll be more accurate...otherwise, it could add an entry to a textfile, and delete when the user leaves...how do you do that?

Kamran A
14/m/mn
Minneapolis, MN
Web Dev/Flash Dev
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 02 May 2002 :  05:27:13  Show Profile  Send ruirib a Yahoo! Message
quote:

I got it to work...but, I want it to end the session on browser close...

that way it'll be more accurate...otherwise, it could add an entry to a textfile, and delete when the user leaves...how do you do that?

Kamran A
14/m/mn
Minneapolis, MN
Web Dev/Flash Dev


I never needed to handle like that. The problem with ending a session on browser close is that browser closing is a client side event and session ending is a server side action.

So you need to deal with it through Javascript, maybe detecting the close event and running a simple server side script to end the session before the browser closes...
You'll have to try it yourself...
For now you can diminish the timeout value maybe to 5 minutes, it will make the value mor accurate.

-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 02 May 2002 :  13:48:13  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
one thing that i have seen done, is when you close websites a pop up window comes up and then says please wait was we log you out, then the window closes itself. this is something you could do.

Brad
Web Hosting with SQL Server @ $24.95 per month
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