Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Application logon
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00362559
Message ID:
00362641
Vues:
16
I guess I didn't clarify what I wanted. I was more concerned about the security of the logon. Anyone with a local
copy of foxpro could access the user table and change/erase passwords. That was my issue. I can do the
form work pretty well. So with that said... any comments on how to handle the security of the user table?


>There's several ways to do a logon and return the results. Besides the TasTrade sample there's a great example by Doug Hennig in FoxTalk. You can get the current windows user, use an INI file, etc but the most common is probably a logon from. Here's a very simple one.
>
>DO FORM logon TO lLogon
>
>This will RETURN a value from the logon form to lLogon
>
>Create a Users table with userid and password
>Create a logon form
>Set the WindowType property of the form to 1 to make the form modal
>Add a property to the form named lLogonSuccessful (default of .F. is fine)
>In the UNLOAD event of the form add RETURN Thisform.lLogonSuccessful
>Add labels and textboxes for User ID and Password
>txtUserID and txtPassword for this example
>In the PasswordChar property of txtPassword enter *
>Add OK and Cancel buttons
>In Click event of the OK button search for the txtUserID and txtPassword values in the users table
>
>  LOCATE FOR users.userid = Thisform.txtUserID.Value
>  * You may want to SET EXACT, use == or use UPPER() for case insensitivity
>  IF !FOUND()
>     ? CHR(7) && beeeep
>     WAIT WINDOW "User ID is not found"
>     Thisform.txtUserID.SetFocus
>  ELSE  && user id found now check password
>     IF Thisform.txtPassword == users.password
>        * Flag logon as successful
>        Thisform.lLogonSuccessful = .T.
>        Release Thisform
>     ELSE
>        ? CHR(7) && beeeep
>        WAIT WINDOW "Password is incorrect"
>        Thisform.txtPassword.SetFocus
>        * You may want to make some loop count or something
>        * For number of unseccessful logon attempts allowed
>        * Thisform.nLogonAttempt=Thisform.nLogonAttempt + 1, etc
>     ENDIF
>  ENDIF
>
>In Click event of the cancel button add Release Thisform
>This will return the default value of .F. of .lLogonSuccessful
>
>Now your lLogon value will be true or false and you can go from there
>? lLogon
>
>HTH Kinda early for me for a Sunday morning so I'll leave any double checking code here to you. ha
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform