good afternoon! I am working in a security project on my own. I am having problems with my checking login code in PHP. I do not know why, but when I try to log in with a user that I have created "the password in database it is in plain text", it says that the password it is incorrect.
THE IDEA IS NOT TO convert the password into a hash. I know that this is a big security risk but obviously that I WILL NOT use it for professional use. My purpose it is for do security tests.
check.php:
<?php
include 'conn.php';
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$name = $_POST['name'];
$password = $_POST['password'];
$result = mysqli_query($conn, "SELECT Name, Password FROM users WHERE Name = '$name'");
$row = mysqli_fetch_assoc($result);
if (password_verify($_POST['password'], $row['Password'])) {
$_SESSION['loggedin'] = true;
$_SESSION['name'] = $row['Name'];
$_SESSION['start'] = time();
$_SESSION['expire'] = $_SESSION['start'] + (1 * 60) ;
echo "<div class='alert alert-success' role='alert'><strong>Welcome!</strong> $row[Name]
<p><a href='edit-profile.php'>Edit Profile</a></p>
<p><a href='logout.php'>Logout</a></p></div>";
} else {
echo "<div class='alert alert-danger' role='alert'>Name or Password are incorrects!
<p><a href='login.html'><strong>Please try again!</strong></a></p></div>";
}
?>
EDIT I have corrected the mistakes but i still having problems logging, appears a menssage: "Name or Password are incorrects!". In my database i have 4 columns without having hashed the information. ID, Name, Email, Password