PDA

View Full Version : password problems...aahhhhh....


rctshine
03-24-2005, 04:05 PM
I want to passowrd protect one of my options, but it doesn't seen to work.

Here is the code I used:

elseif (nSelectedControl == CTRL_RADIO_BUTTON_03) then
passy = Dialog.PasswordInput("Enter Password", "Password Version Password", MB_ICONQUESTION);
pass = "pass";
password_checked = String.Compare("passy", "pass");
if (password_checked == true) then
rest = Dialog.Message("Notice", "Message.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
Screen.Jump("next screen");
elseif (password_checked ~= true) then
Screen.Jump("error");
end
end


I don't know what the error is....but even if I enter the correct password, it sends me to the "error" page.....AAAAAAAAHHHHHHHH.

Please help me....
Thanks.

rctshine
03-24-2005, 04:26 PM
Forget it, I figured it out.

I also made a way to keep track of how many times the user have tried, and limit it to three:

On Preload:

if not areacheck then areacheck = {}; end

areacheck.MaxAttempts = 3;

if(areacheckgm.AttemptCount == nil) then
areacheck.AttemptCount = 0;
end


On Next:

elseif (nSelectedControl == CTRL_RADIO_BUTTON_03) then
real_password = "pass";
user_password = Dialog.PasswordInput("Password", "Please enter the password: ", MB_ICONQUESTION);
if real_password ~= user_password then
areacheck.AttemptCount = areacheckgm.AttemptCount + 1;
passno = Dialog.Message("ERROR", "Incorrect Password.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
if(passno == IDOK) then
Screen.Jump("sorry");
-- if the user is out of retries, exit the application
if(areacheck.AttemptCount >= areacheck.MaxAttempts) then
Application.Exit(0);
end
end
end
if real_password == user_password then
rest = Dialog.Message("NOTE", "Your Message here.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
if(rest == IDOK) then
Screen.Jump("whatever screen");
end
end
end



Hehehe.
No more errors there.....
On to the next problem....

Tek
03-24-2005, 04:54 PM
Try this. I have not personally tested it.

Edit: Woops... too late.


elseif (nSelectedControl == CTRL_RADIO_BUTTON_03) then
passy = Dialog.PasswordInput("Enter Password", "Password Version Password", MB_ICONQUESTION);
pass = "pass";
password_checked = String.Compare("passy", "pass");
if (password_checked) then
rest = Dialog.Message("Notice", "Message.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
Screen.Jump("next screen");
else
Screen.Jump("error");
end
end