大家好,我爲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我的密碼是小寫的 –