Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Application logon
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00362559
Message ID:
00362584
Views:
20
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform