如何仅通过登录页面接受注册用户
问题描述:
我期待创建一个登录页面,只有注册用户才能登录。我试过下面的代码,但它不工作。我提到了我的存储过程以及我的登录页面代码。如何仅通过登录页面接受注册用户
create procedure cp(in username,in password,out yes_no)
BEGIN
SELECT count(*) INTO yes_no
FROM user1 u
WHERE u.USERNAME = username && u.PWD = password_p;
END
<body>
<h2>Login Form</h2>
<form action="/action_page.php">
<div class="container">
<label><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="uname" required>
<label><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" required>
<button type="submit">Login</button>
<input type="checkbox" checked="checked"> Remember me
</div>
<div class="container" style="background-color:#f1f1f1">
<button type="button" class="cancelbtn">Cancel</button>
<span class="psw">Forgot <a href="#">password?</a></span>
</div>
</form>
</body>
</html>
<?php
$connection = mysqli_connect("localhost", "root", "", "seb");
$result = mysqli_query($connection,
"CALL cp") or die("Query fail: " . mysqli_error());
?>
答
我想使用存储过程
尼基尔试着先了解基本概念的登录页面添加验证。 Stored Procedure
并不意味着验证数据,它的服务器端脚本可以处理这个问题。让你的服务器端脚本可以得到用户输入的值,用不同的规则验证它(如果有效的话),用这些值调用存储过程。