Gabis
12-29-2005, 03:05 PM
Hey everyone. What I'm trying to do is create a button that when clicked:
a)prompts the user to enter a password(using Dialog.Input not PasswordInput)
b)Generates an MD5 string for the password and compares it with 7 other MD5 strings
c)depending on the MD5 string returned, performs a specific action
d)if the MD5 generated by the user input does not match any of the 7 other strings, pops up a message telling them the password was incorrect.
I accomplished a, b and c with relative ease, but the use of multiple "if" statements disallows me to use an "else" statement(or so I think is the problem). The reason for this is to install specific language files onto the users computer for my app. For security reasons, only specific users should be able to install/use specific language files and creating an install for each language would be a giant pain in the butt. The files will be stored in pw-protected ZIP's. I know this isnt the most secure thing in the world, but most of the users arent all that computer literate so its good enough for our purposes.
the script is below, note at this time with successful password input I only bring up a dialog box telling me which was entered. This is just for testing purposes. Also for testing purposes, I have only made if statements for 4 of the 7.
function lang_pw()
-- the MD5 strings for passwords by language
French_MD5 = "2ed6ab3d9b07c9a2f8ef51e913fae686"
Italian_MD5 = "6b74b87b7e2b049604ad96c59c36b42f"
Spanish_MD5 = "90ef5e6d211ded4e06dda0d265649e2b"
Russian_MD5 = "b8003391845c34bae900086c90656b3e"
Polish_MD5 = "880388188c719d0de116ce411919fb2f"
German_MD5 = "be66863ed1ecaf17935914f3ad5f2485"
Port_MD5 = "337f9174218c70f5a663cc2e24032898"
-- prompt the user to enter password
user_password = Dialog.Input("Password", "Please enter the password provided to you:");
-- Calculate MD5 from user password
user_password_md5 = Crypto.MD5DigestFromString(user_password);
-- Compare the users password with language passwords
if user_password_md5 == French_MD5 then French_Install = Dialog.Message("French!", "You have entered the french pw", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1); end
if user_password_md5 == Italian_MD5 then Italian_Install = Dialog.Message("Italian!", "You have entered the Italian password", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1); end
if user_password_md5 == Spanish_MD5 then Spanish_Install = Dialog.Message("Spanish!", "You have entered the Spanish password", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1); end
if user_password_md5 == Russian_MD5 then Russian_Install = Dialog.Message("Russian!", "You have entered the Russian password", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1); end
end
a)prompts the user to enter a password(using Dialog.Input not PasswordInput)
b)Generates an MD5 string for the password and compares it with 7 other MD5 strings
c)depending on the MD5 string returned, performs a specific action
d)if the MD5 generated by the user input does not match any of the 7 other strings, pops up a message telling them the password was incorrect.
I accomplished a, b and c with relative ease, but the use of multiple "if" statements disallows me to use an "else" statement(or so I think is the problem). The reason for this is to install specific language files onto the users computer for my app. For security reasons, only specific users should be able to install/use specific language files and creating an install for each language would be a giant pain in the butt. The files will be stored in pw-protected ZIP's. I know this isnt the most secure thing in the world, but most of the users arent all that computer literate so its good enough for our purposes.
the script is below, note at this time with successful password input I only bring up a dialog box telling me which was entered. This is just for testing purposes. Also for testing purposes, I have only made if statements for 4 of the 7.
function lang_pw()
-- the MD5 strings for passwords by language
French_MD5 = "2ed6ab3d9b07c9a2f8ef51e913fae686"
Italian_MD5 = "6b74b87b7e2b049604ad96c59c36b42f"
Spanish_MD5 = "90ef5e6d211ded4e06dda0d265649e2b"
Russian_MD5 = "b8003391845c34bae900086c90656b3e"
Polish_MD5 = "880388188c719d0de116ce411919fb2f"
German_MD5 = "be66863ed1ecaf17935914f3ad5f2485"
Port_MD5 = "337f9174218c70f5a663cc2e24032898"
-- prompt the user to enter password
user_password = Dialog.Input("Password", "Please enter the password provided to you:");
-- Calculate MD5 from user password
user_password_md5 = Crypto.MD5DigestFromString(user_password);
-- Compare the users password with language passwords
if user_password_md5 == French_MD5 then French_Install = Dialog.Message("French!", "You have entered the french pw", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1); end
if user_password_md5 == Italian_MD5 then Italian_Install = Dialog.Message("Italian!", "You have entered the Italian password", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1); end
if user_password_md5 == Spanish_MD5 then Spanish_Install = Dialog.Message("Spanish!", "You have entered the Spanish password", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1); end
if user_password_md5 == Russian_MD5 then Russian_Install = Dialog.Message("Russian!", "You have entered the Russian password", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1); end
end