I try to login into my application using my account from database that the password are encrypted (but i don't know what's encrypt method, is it using md5 or sha256 IDK).
Here is my encrypted password " $2y$10$lMw3VSF7dQlIlnCjvWtrE.smQEslGBPFbvLxy0ROo1kPVzmmlj2ui " the password is 1234 if it's not using encrypted method.
The problem is when i try to login using 1234 it's just can't login, but when i input $2y$10$lMw3VSF7dQlIlnCjvWtrE.smQEslGBPFbvLxy0ROo1kPVzmmlj2ui the system is redirecting me to index.php (login is success)
Here is my code :
<div class="container-fluid">
<div class="row">
<div class="col-lg-4 offset-lg-4 mt-5">
<div class="card shadow">
<div class="card-body">
<center><img src="aset/login.jpg" style="max-width:300px;max-height:300px;" class=""></center>
<h4 class="text-center">LogIn CPPT</h4>
<hr>
<form method="post" action="">
<label>Username</label>
<input type="text" class="form-control" name="Username" autocomplete="off" required>
<label>Password</label>
<input type="password" class="form-control mb-3" name="Password" autocomplete="off" required>
<center><a href="https://api.whatsapp.com/send?phone=6281290231840&text=Permisi,%20Saya%20lupa%20password%20aplikasi%20CPPT%20saya,%20mohon%20dikirimkan%20password%20baru.%20Terimakasih." target="_blank" class="mt-3">Lupa kata sandi?</a></center>
<marquee class="text-danger"><b>RSU Amanah Sumpiuh, Banyumas, Jawa Tengah - Aplikasi Catatan Perkembangan Pasien Terintegrasi</b></marquee>
<button class="btn btn-success mt-3 float-end" name="LOGIN" type="submit"><i class="fa fa-arrow-circle-right" aria-hidden="true"></i> Masuk</button>
</form>
</div>
</div>
</div>
</div>
</div>
<?php
if (isset($_POST['LOGIN'])) {
$Username = $_POST['Username'];
$Password = $_POST['Password'];
$sql = mysqli_query($connection4, "SELECT * FROM RSUPengguna WHERE Username = '$Username' and Password = '$Password'");
$tiliki = mysqli_num_rows($sql);
if ($tiliki > 0) {
$_SESSION['Username'] = $_POST['Username'];
echo "<meta http-equiv=refresh content=0;URL='index.php'>";
} else {
echo "<script type='text/javascript'>alert('Username atau Password Tidak Benar!');</script>";
echo "<meta http-equiv=refresh content=2;URL='login.php'>";
}
}
?>
Anyone can solve this problem?