forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Need Three Attempts At Correct Password

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
starfire
Newbie


Joined: 16 Dec 2008
Posts: 24
Location: Florida USA

PostPosted: Thu Dec 25, 2008 1:58 pm    Post subject: Need Three Attempts At Correct Password Reply with quote

Hi Everyone,

I did a search on VDSWorld and found some password code that does work for prompting a customer for a password. What can I add to this code to give the customer three attempts at typing in the correct password before it ends?

Title Xform
%%password = password
if @not(@equal(@input(Enter Password To Login.,,PASSWORD),%%password))
info UNAUTHORIZED LOGIN ATTEMPT!!! - Program Terminated
exit
end

I did this and it continues to prompt but it is not the solution I was going for:

Title Xform
:repeat
%%password = password
if @not(@equal(@input(Enter Password To Login.,,PASSWORD),%%password))
info Password Incorrect. Login Failed.
goto repeat
exit
end

Any Suggestions ?



Thanks
Starfire
Back to top
View user's profile Send private message
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Thu Dec 25, 2008 5:25 pm    Post subject: Reply with quote

Try this...

Code:
Title Xform

%%Count = 0
%%authenticated = 0

repeat
%%Count = @succ(%%Count)
%%password = password
if @not(@equal(@input(Enter Password To Login.,,PASSWORD),%%password))
 info Password Incorrect. Login Failed. @cr()(%%Count) Attempt(s)
else
 %%authenticated = 1
 %%Count = 3
end
until @equal(%%Count,3)

If @equal(%%authenticated,1)
 info Proceed with xForm...
else
 info Login attempts exceeded!@cr()@cr()Shutting down...
 stop
end
exit
Back to top
View user's profile Send private message Send e-mail
starfire
Newbie


Joined: 16 Dec 2008
Posts: 24
Location: Florida USA

PostPosted: Thu Dec 25, 2008 7:06 pm    Post subject: Reply with quote

Very Cool Aslan,

The code you provided works great. Just what I was aiming at to get to work. I did switched around the order for end exit to exit end. It would not work the other way.

By the way. When the customer clicks Cancel Instead of OK after entering the correct or incorrect password is there a way for the code to exit rather than to go to the next attempt?

Thank you from a struggling VDS newbi.

Thanks
Starfire
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Fri Dec 26, 2008 8:56 am    Post subject: Reply with quote

Hey there!

Try this:

Code:

Title Xform

%%Count = 0
%%authenticated = 0

repeat
%%Count = @succ(%%Count)
%%password = password
%%input = @input(Enter Password To Login.,,PASSWORD)
if @null(%%input)
 info Login cancelled! Exiting...
 goto exit
elsif @not(@equal(%%input,%%password))
 info Password Incorrect. Login Failed. @cr()(%%Count) Attempt(s)
else
 %%authenticated = 1
 %%Count = 3
end
until @equal(%%Count,3)

If @equal(%%authenticated,1)
 info Proceed with xForm...
else
 info Login attempts exceeded!@cr()@cr()Shutting down...
 stop
end

:exit


Greetz
Dr. Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
starfire
Newbie


Joined: 16 Dec 2008
Posts: 24
Location: Florida USA

PostPosted: Fri Dec 26, 2008 4:01 pm    Post subject: Reply with quote

Hey back at you Dr. Dread,

Your suggestion worked out great. I knew there must have been a way to make it work but just could not figure it out in my head and limited experience with VDS.

Thanks
Starfire
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group