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

Login only once 7

Status
Not open for further replies.

jimstarr

Programmer
Feb 6, 2001
975
US
A requirement of the system I'm working on is that no single user can login multiple times. Each user has a password. What's the best way to implement this?

Jim
 
jimstarr

Setup a daily login/logout table, check for existing UserId and if found() show the user the door, otherwise append new record with UserId, and allow access.

Chris :)
 
Thanks Chris. I'm just concerned about situations like system crashes where logout doesn't occur properly.

Jim
 
Jim,
One way to do this is to maintain a record for each user. When they login, have the program lock this record (you'll have to keep this file open for the "duration"). If the same user tries to login again they won't be able to get this lock. If the user's system crashes, then the server will release the lock when it decides the connection has been servered (how long depends on the file server's OS and the appropriate configuration options).

Rick
 
To go little deeper into suggestion rgbeen's suggestion...

I am using a similar approach with much more functionalities
1. I open an invisible form for this purpose with a private data session at the beginning just after login with parameters of login ..
2. Open the Password file in the DE.
3. Check for the user/password and lock the record.
4. Dont release the form which is invisible. Continue with other forms etc. and release it only at the end of the application.

You can have a field for flaging with operation type. For example - data backup, restore, period end processing etc. operations are done after writing a flag in the flag field. This helps to let know all users some system operations status. Also helps to stop any user from loging in. This I do by locking all records for critical system operations or warning to avoid doing such critical activities, if others are loged in.

So mutiple purpose can be achieved in this way. In fact I use this for much more functions not explained here.

Hope this gives you some more insight into this thinking and I have been of some help to you.

ramani :)
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Hello, ramani

Creating a hidden window just to have a dataenvironment is kinda quirky, because dataenvironment can be created as a object, using

PUBLIC de
de = createobject('dataenvironment')

Using ADDOBJECT you can obtain the same environment. Personally I like this aproach...

Hope this helps, Grigore Dolghin
Class Software
Bucharest, Romania
 
Thanks Gregore Dolghin. Let me try it out and feel my preference. I have done that invisible form and feel absolutely solid in that. More over that form gets copied to every project I develop and I am very comfortable with it. Your idea is noted. Thanks again. ramani :)
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
PMFJI, but I was redirected from thread184-95381.

<snip>
1. I open an invisible form for this purpose with a private data session

Ramani,
SP3 introduced the Session class for exactly that purpose. Flexibility of a private data session w/o the overhead of a form. :)

Grigore,
I believe the reason Ramani chose to use a form is because it provides a private data session. The DataEnvironment class doesnt provide this functionality; hence it always opens in the datasession that is current when it is created. :) Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top