大家好,我为login创建了一个验证,其中login_id和密码是正确的,然后它会重定向到另一个页面,我的代码也在验证。但是我发现了一个错误,就是如果我在密码中输入密码,它也会采取正确的操作,而我的密码是在小信中,我不知道为什么它接受请给我解决方案谢谢。为什么我的密码接受小写和大写字母
<?php
//include('connection.php');
if(isset($_POST['button']))
{
session_start();
$con = mysqli_connect("localhost","root","","school");
echo $username=$_POST['username'];
$password=$_POST['password'];
//$sql="select * from login where username='$username' and password='$password'";
$sql = mysqli_query($con,"SELECT * from login where username='".$username."' AND password='".$password."' LIMIT 1");
//$query=mysqli_query($con,$sql);
$count=mysqli_num_rows($sql);
if($count > 0)
{
echo $_SESSION['username']=$username;
header("location:Dashboard.php");
}
else
{
//header("location:Login.php");
echo '<div class="alert alert-danger">
<strong>username and password wrong!!!.</strong>
</div>';
}
}
?>
检查数据库中的密码,它是如何插入的?也许密码是以小写字母插入的。 – AnthonyB
首先密码不直接保存安全原因。 –
@AnthonyB我的密码是小写的 –