PDA

View Full Version : delete project on wrong password so many times?


insane
06-15-2007, 12:24 PM
i found this code below...
what i want to do is if they enter the wrong password "X" many of times wrong, is there a way to Disable running the app, or deleting the app?

On the Page Preload
nChance = 1

On button click
real_password = "valid";
-- prompt the user to enter a password
user_password = Dialog.PasswordInput("Please enter the password:", "You have three attempts, then the application will exit. ", MB_ICONQUESTION);
if user_password ~= "CANCEL" and user_password ~= "" then
-- compare the user's password to the correct password.
if real_password ~= user_password then
---check for attempt #
if nChance < 3 then
wrong = Dialog.Message("Wrong Password", "Attempt #"..nChance..". Try again?", MB_YESNO, MB_ICONQUESTION, MB_DEFBUTTON1);
if wrong == 6 then
nChance = nChance + 1
Page.ClickObject("Button1")
else
nChance = nChance + 1
end
else
Application.Exit(0);
end
else
Page.Jump("Page2");
end
end

stickck
06-16-2007, 08:48 AM
Here's a simple way to prevent them from using the project again. Well unless they just get a new copy of the project.

If you delete the CDD file in the Autoplay folder, the project can run.

On the Page Preload
nChance = 1

On button click
real_password = "valid";
-- prompt the user to enter a password
user_password = Dialog.PasswordInput("Please enter the password:", "You have three attempts, then the application will exit. ", MB_ICONQUESTION);
if user_password ~= "CANCEL" and user_password ~= "" then
-- compare the user's password to the correct password.
if real_password ~= user_password then
---check for attempt #
if nChance < 3 then
wrong = Dialog.Message("Wrong Password", "Attempt #"..nChance..". Try again?", MB_YESNO, MB_ICONQUESTION, MB_DEFBUTTON1);
if wrong == 6 then
nChance = nChance + 1
Page.ClickObject("Button1")
else
nChance = nChance + 1
end
else
File.Delete("AutoPlay\\untitled.cdd", false, true, true);
Application.Exit(0);
end
else
Page.Jump("Page2");
end
end

That's one easy way. i don't know how Vista will like it. i haven't switched over to me new Vaio yet.

chris