Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count session values

Status
Not open for further replies.

bobbyr

Programmer
Nov 30, 2000
66
0
0
US
Is there a way to count session values such as how many people are logged in with a session("GroupId") = 5 ?

Thanks,
Bobby R
 
I don't believe so.

I recommend that you add this to you global.asa file...

sub session_OnStart
application("usersOn") = application("usersOn") + 1
end sub

sub session_OnEnd
application("usersOn") = application("usersOn") - 1
end sub

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Thanks, I hadn't heard of anything like that before, but you never know. Probably what would be better is just make a "LoggedIn" table in the db and write session data there when someone logs in and delete when session ends..

Thanks,
Bobby
 
Why use a table and the additional overhead when an application variable can hold the data easily?

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
I'm not simply counting the number of users that are logged in. I have multiple customers loggin in from different locations and need to track the number of users from each location as part of a licensing scheme.

So.. when a person logs in from Customer A, they get a session("CustomerId") = "A", Customer B gets a session("CustomerId") = "B", and so on. I need to be able to count the number of Customer A's that are on the system at a given time to limit their number of logins to whatever their license number is.

Bobby
 
so when you verify where they are from (be it a,b,c or d) you can still use the application variable...

when you set session("CustomerId") = "A"

you can add this line...

application(session("CustomerId")) = application(session("CustomerId")) + 1

and in the session_onEnd you can add:

if session(&quot;customerId&quot;) <> &quot;&quot; then
application(session(&quot;CustomerId&quot;)) = application(session(&quot;CustomerId&quot;)) - 1
end if



Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top