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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limiting the number of users

Status
Not open for further replies.

mlawson

Technical User
Jun 12, 2001
197
GB
I have an application that will be licenced for use for defined numbers of users. Now we all know that they will buy a 10 user licence and try and have all 397 folk using it. Can I limit the number of active users using the application by either session variables (or poss application variables) or at the database level? All suggestions welcome!

M
 
You can set an application level variable that would just be a simple INT

Increment it in session_OnStart

Decrement it in session_OnEnd

Check the value each time a user logs in.

You can declare it in the application_OnStart subprocedure.

All these events are subs in global.asa of your project.

lemme know if you need more detail. :)
paul
penny1.gif
penny1.gif
 
Hi

You sure can! Crack open your Global.asa file and keep track of the number of people currently using your application by using the
Code:
Session_OnStart
event and the
Code:
Session_OnEnd
event. Like this
Code:
Sub Session_Onstart
Application.Lock
Application("numusers") = Application("numusers") + 1
Application.Unlock
End Sub

Sub Session_OnEnd
Application.Lock
Application("numusers") = Application("numusers") - 1
Application.Unlock
End Sub

We can go into this more if necessary.

Be sure you add a cursory application variable check at the beginning of all of your pages:

If Application("numusers")>10 then
   redirect to a page with a finger wagging at them!
   response.end
End if

That'll upset the heck out of them!

Derren
[The only person in the world to like Word]
 
D'oh!

Now I know what it's like to be usurped! Derren
[The only person in the world to like Word]
 
Thanks guys, I'll give these a go. I liked the option proposed by Derren, it's always good to put the frighteners up the perps, so I'll think up something that's suitably scary (maybe a picture of Anne Robinson "weakest link" ??).

I'll get back once I've got my teeth into it.

M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top