我有一個帶有一些身份驗證和驗證的 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 很陌生,如果我錯過了任何東西,我很抱歉
檢查 PHP 表單是否有效以在 3 次嘗試后鎖定用戶
斯蒂芬大帝
2021-05-30 08:47:41