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

Creating a User Login for a Foxpro Application

Status
Not open for further replies.

Samalia

Technical User
Jun 7, 2005
46
0
0
CA
When using the application builder there is an option under the general tab to use user logins, but this seems to be a useless feature as there is no where to set up which users I want to have and to give them permissions, and when I run the application, I can simply enter in a new user and then create a password and they have full access to the application. There doesn't seem to be any security to this feature. Is there a way that I can restrict access to a foxpro application? I can't seem to find anything usefull in the helpfiles.
 
What Application Builder ???

Are you working in someone else's application which already has some General Tab page?
If so then it is a matter of knowing more about this application, not VFP itself.

When the vast majority of us build applications we are doing so through a VFP Project and utilizing discrete Program, Forms, Menus, etc.

If you build your own application you can create your own Login Form and enforce your own login access (user rights, passwords, etc.).

Good Luck,
JRB-Bldr
 
Take a look into what the appbuilder generates. In the first place the underlying framework is not the best and the application wizard is very old, not using newer foxpro features etc.

Regarding adding an unknown user as new user open up the project, go to the classes tab, expand the node of the classlib <<projname>>_app and open the app_userlogin form class. Now open up the method "oktoadduser". It returns .T. always and it's up to you to change that code to whatever condition you want, eg RETURN .F., if it's not okay to add users anymore. For example you can limit adding users by only allowing certain windows accounts, eg RETURN getenv("Username") $ "comma seperated list of admin user account names".

application builder wizard will not absolve you from knowing about foxpro commands etc. You would also need to learn about the architecture of the app framework used from that wizard and very few users are using this wizard to build apps, so you're quite alone with it. See jrbbldr's reply...

Bye, Olaf.
 
Samalia,

Using the Application Builder is not the best way to get started with a VFP application, and in any case it doesn't generate any functional code -- rather, it does the initial housekeeping, such as creating directories and the like.

In general, if you have a login form, you will probably also need a User table. This is an ordinary DBF file that holds, as a minimum, the user's login name and their password. Depending on your needs, it might also hold the user's real name, and details of any security settings they might have.

The password should ideally be encrypted. A very simple way to do that is to store it as a checksum, using VFP's SYS(2007) function.

In the login form, you need to do a simple search on the login name and (encrypted) password. If you succeed in finding a record, the user is good to log in. If you don't, then either the login name, the password, or both is invalid.

Elsewhere in the application, you'll need a "manage users" function, by which an adminstrator can add and delete users, plus a "change password" facility.

All these things are pretty generic, so it would be a good idea to build them all into a general-purpose class that you could then use in any application.

Hope this is of some use.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top