为了账号安全,请及时绑定邮箱和手机立即绑定

检查 PHP 表单是否有效以在 3 次尝试后锁定用户

检查 PHP 表单是否有效以在 3 次尝试后锁定用户

斯蒂芬大帝 2021-05-30 08:47:41
我有一个带有一些身份验证和验证的 php 登录表单。到目前为止,我想要运行的特定脚本如下:<script type="text/javascript">var login_attempts=3;function check_form() {    //This is where I want the code to check if the form is valid and will be submitted {   alert("SuccessFully Logged In");   //Not sure if I need this as the form contains PHP so if the credentials are correct then tehy go to another page }  else      {       if(login_attempts==0)       {       alert("No Login Attempts Available");       }    else      {      login_attempts=login_attempts-1;      alert("Login Failed Now Only "+login_attempts+" Login Attempts Available");    if(login_attempts==0)       {        document.getElementById("name").disabled=true;        document.getElementById("pass").disabled=true;        document.getElementById("form1").disabled=true;  } }}return false;}   </script>我想要这个的原因是,在用户尝试登录 3 次后,我想要一个警报框显示一条消息,并阻止用户在框中输入任何内容。我实际上不想从数据库端锁定帐户,因为用户正在对用户名和密码以外的信息进行身份验证。我对 Js 很陌生,如果我错过了任何东西,我很抱歉
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 152 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信