任何帮助,将不胜感激。我有一个登录表单,当用户输入密码时,我不知道如何检查密码,它只检查用户名并验证。它只是一个简单的登录,不太强调安全性。任何帮助将不胜感激。干杯!
public function adminl() {
if (!empty($_POST['username']) && !empty($_POST['passw'])) {
// get user's data
$con = $this->db->prepare("SELECT id,
username, passw,
passw
FROM admin
WHERE username = :username;");
$con->execute(array(':username' => $_POST['passw']));
$count = $con->rowCount();
if ($count == 1) {
if( $con->execute(array(':passw' => $_POST['username'])) == 1) {
// fetch one row
$result = $con->fetch;
return true;
echo "success";
}
}
else {
echo "Failed to login";
}
}
}