Global Variable

jaymz69 used Ask the Experts™
I have a form the starts up
I load a Public Variable for the password

as the timer runs and executes and a program runs

the code on the program executing is:
 lnPwd = g_lnPwd

is this the best way or is there another?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

The code is OK, but you do want a local variable for a password compare security.


how's that?
Public variable to keep the password is not a good solution. You should not leave passwords or any other sensitive information in variables. You should ask user for the password, process it, set some program restrictions (if the password is intended for this purpose) and delete such variable contents immediatelly.

Passwords stored in database should not be in open text but encrypted or stored as some hash.

The reason is easy - users could read error logs containing sensitive information occassionaly.

And if you are asking what and how to store then VFP can offer SYS(2007) function which calculates CRC32 from any text:

? SYS(2007,"password",0,1)

The result of SYS(2007) can be stored into a DBF without a necessity to disclose the original password.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial