View Full Version : Active Users via global.asa with IP not session ID
Morgoth
08-13-2003, 12:32 PM
Hello, I have a problem where I do not want to calculate the active users by the session ID anymore.
The session ID only works when the user allows cookies, but if the user doesn't allow cookies then the active users number keeps adding up and up.
What I wish to do is use the IP of a user, and calculate all the IP addresses together to find out the active users.
I also want to use the global.asa, if possible, and without a database or a text file.
Anyone ever done this? Think it's possible, keep in mind the last thing said above?
Without using a txt or db, your only option would be to use the global.asa's Session_Onstart and the Session_OnEnd sub.
So what you could do is store the IP's in an applicationvariable, for all clients that don't accept cookies
In your global.asa, you check the IP's array, like
Check = Filter(application("noncookies"),request.servervariables("REMOTE_ADDR"))
If Len(check(0)) > 0 then
response.redirect etc
else
application("visitors") = application("visitors") + 1
response.redirect("page1.asp")
end if
(or whatever it's called)+ redirect to a page that writes the cookie. and then redirects to page 2 (your actual startpage or the requested page) that reads the cookie. I the cookie can't be read, the IP is added to the application array. Like
dim num
num = Ubound(application("noncookies")) + 1
application("noncookies")(num) = request.servervariables("REMOTE_ADDR")
And then redirect to the actual startpage or the requested page.
On the Session_OnEnd, hmm. That's kinda tricky. You need to know if this is the last active session for that IP. At first sight, i'd think you would need a 2-dimensional application-array for that, but then you can't use Filter, and you'd need a loop there and on page 2
But it's a lott of hassle for this little feature.
Maybe an alternative is to append a variable to all url's for non-cookie users (like it's done in PHP). It would be easier, but this would require some thought + wount produce an accurate count for people who enter an url in the adressbar.
Morgoth
08-13-2003, 11:00 PM
Originally posted by raf
...wount produce an accurate count for people who enter an url in the adressbar.
That's the problem. I really want to get an accurate reading... But, I have decided the only way to do this is store the ip in a database with the date which I will use for timeing out.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.