Author |
Topic |
|
SubKamran
Junior Member
101 Posts |
Posted - 29 April 2002 : 19:05:10
|
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
|
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
|
|
|
SubKamran
Junior Member
101 Posts |
Posted - 01 May 2002 : 19:06:46
|
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 |
|
|
SubKamran
Junior Member
101 Posts |
Posted - 01 May 2002 : 19:21:47
|
Nevermind...had to look more...
THANKS!
Kamran A 14/m/mn Minneapolis, MN Web Dev/Flash Dev |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 01 May 2002 : 20:09:42
|
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 |
|
|
SubKamran
Junior Member
101 Posts |
Posted - 01 May 2002 : 22:41:29
|
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 |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 02 May 2002 : 05:27:13
|
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 |
|
|
redbrad0
Advanced Member
USA
3725 Posts |
Posted - 02 May 2002 : 13:48:13
|
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
|
|
|
|
Topic |
|