我正在用PHP编写一个应用程序,它使用表单来检索用户名和密码输入.成功登录后,Web浏览器将提示保存用户名和密码(使用Firefox,Safari和Chrome进行测试).
但是,如果用户登录失败,浏览器仍会提示保存密码(这显然不是预期的行为).如何指示浏览器登录失败并且不会提示保存详细信息?
以下是登录页面的HTML:
<html>
<head><title>Login</title></head>
<body>
<style text="css">
fieldset {
padding: 10px;
width: 250px;
text-align: right;
}
</style>
<form method="POST" action="checkLogin.php">
<fieldset>
<label for="user">Username: <input type="text" id="user" name="username" size="15" /></label><br />
<label for="pass">Password: <input type="password" id="pass" name="password" size="15" /></label><br />
<p><input type="submit" value="Login" /></p>
</fieldset>
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
checkLogin.php脚本只是检查数据库的登录信息以确保它是有效的,如果凭据不正确,则打印"登录尝试失败".
有人可以对这个问题有所了解吗?我知道这是一个小问题,但我没有注意到我的浏览器提供保存其他网站上登录失败的密码.
提前致谢!