Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
User Locking problem
Message
From
12/07/2006 05:59:25
 
 
To
12/07/2006 05:12:58
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01135587
Message ID:
01135600
Views:
11
>I got an application in the server, client's PC map 'S' as network drive
>link to the server,
>my system will place in "S:\AcctSystem\"
>
>If that company got 10 PC, they can map the S drive and run the exe easily.
>Now, we need to control the license with 5 users which can login the system
>I got a little idea
>(1) when 1 user login ( increment a field nooflogin in a LoginTable )
>(2) everytime user login (I will check the nooflogin , if the number over 5)
>, reject user login
>(3) everytime user logout the user(nooflogin will be decreased )
>
>Problem : If the user didn't logout very well, ( task manager kill the task
>or PC hangs) that will make the no of login incorrect,
>
>Can anyone give me some idea to do ??
>Thanks a lot

Agnes

I have a simple, empty text file, in the same dir as the app, called FAILSAFE.DAT. In the situation you described the user simply deletes this file. The login logic, in my case, works as below. If it finds the failsafe file missing it sets all user logged on status to .F. then recreates the failsafe file:
Select SYSTEMUSERS

* Test to see if Failsafe file exist. If not, user has deleted it in order to continue 
* using system after it crashed, leaving all then current user sysUsers recs
* flagged as logged on, or this is the first time ever. So reset all logged on 
* flags in the sysUsers table and re-create the file
* ________________________________________
Wait WINDOW "Log on please" NOWAIT NOCLEAR
lcCurDir	= SYS(5) + SYS(2003)
If not FILE( lcCurDir + "\FAILSAFE.DAT")	&& If no failsafe file in existance...
    Select sysUSERS	
    If not EMPTY( USERID)			&& If at least 1 user registered...
	Replace LOGGEDON with .F. all	&& ...Reset all logged in flags
	= TABLEUPDATE(.T.)
    EndIf not EMPTY(USERID)
    = FCREATE( lcCurDir + "\Failsafe.Dat")	&& Create or re-create Failsafe dummy file
EndIf not FILE("FAILSAFE.DAT")		&& If no failsafe file in existance...
Incidentally, why not just have a logged_on (T/F) flag in each user's account, then, at start up you simply do:

Select SYSTEMUSERS
Count for LOGGED_ON to lnNumUsers

If lnNumUsers = 5
Wait window "Go away! we're full!"
Else
* Alow log in
EndIf

HTH

Terry
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Previous
Reply
Map
View

Click here to load this message in the networking platform