如果总尝试次数为3,请检查密码是否错误。 [英] check whether the password is wrong if total attempt are 3.
本文介绍了如果总尝试次数为3,请检查密码是否错误。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只想要while或for循环来检查输入错误的密码是否超过3次,然后请求Captcha请有人帮助我。我不想使用任何会话或数据库命令。
解决方案
一些伪代码:
< pre lang =text> passwordCorrect = false;
attemptCount = 0;
while((attemptCount< 3)&(passwordCorrect == false))
{
pwd = getPassword
attemptCount ++
passwordCorrect = isPasswordCorrect( pwd)
}
if passwordCorrect!= true
{
displayErrorMessage
QuitOrExitOrWhateverElseHere
}
请看这里:
http://cboard.cprogramming.com/cplusplus-programming/149066-password-check-3-attempts.html [ ^ ]
http://www.cplusplus.com/forum/beginner/37805/ [ ^ ]
但是请仔细阅读这篇关于安全的资料用C ++编写代码:
http://www.cert.org /archive/pdf/sd-bestpractices-strings060914.pdf [ ^ ]
如何处理循环..?
你可以使用一个静态变量来存储服务数量
并在登录按钮点击事件检查其值,如果执行三个显示CAPTCHA ..
别忘了增加其值...
I just want the while or for loop for checking if the wrong password is entered more than 3 times, then ask for Captcha please someone help me. I don't want to use any session or database command.
解决方案
Some pseudocode:
passwordCorrect = false; attemptCount = 0; while ((attemptCount < 3) & (passwordCorrect == false)) { pwd = getPassword attemptCount++ passwordCorrect = isPasswordCorrect(pwd) } if passwordCorrect != true { displayErrorMessage QuitOrExitOrWhateverElseHere }
Please look here:
http://cboard.cprogramming.com/cplusplus-programming/149066-password-check-3-attempts.html[^]
http://www.cplusplus.com/forum/beginner/37805/[^]
But please carefully read this material about "Secure Coding in C++":
http://www.cert.org/archive/pdf/sd-bestpractices-strings060914.pdf[^]
what to do with loops..?
you can use a static variable to store number of attepts
and in login button click event check its value, if exeeds three show CAPTCHA..
dont forget to increment its value...
这篇关于如果总尝试次数为3,请检查密码是否错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文