こんにちは、私は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私のパスワードは小文字である –