I have a php
that is connected to a BD Mysql
and that its function is a login , the problem is that it always shows me that the user or password they are incorrect even if they are not.
I leave you the PHP
<?php
session_start();
?>
<?php
$host_db = "localhost";
$user_db = "u268055042_audit";
$pass_db = "auditorioandroid";
$db_name = "u268055042_audit";
$tbl_name = "tbl_login";
$conexion = new mysqli($host_db, $user_db, $pass_db, $db_name);
if ($conexion->connect_error) {
die("La conexion falló: " . $conexion->connect_error);
}
$username = $_POST['username'];
$password = $_POST['password'];
$sql = "SELECT * FROM $tbl_name WHERE email = '$username'";
$result = $conexion->query($sql);
if ($result->num_rows > 0) {
}
$row = $result->fetch_array(MYSQLI_ASSOC);
if (password_verify($password, $row['password'])) {
$_SESSION['loggedin'] = true;
$_SESSION['username'] = $username;
$_SESSION['start'] = time();
$_SESSION['expire'] = $_SESSION['start'] + (5 * 60);
echo "Bienvenido! " . $_SESSION['username'];
echo "<br><br><a href=panel-control.php>Panel de Control</a>";
} else {
echo "Username o Password estan incorrectos.";
echo "<br><a href='login2.html'>Volver a Intentarlo</a>";
}
mysqli_close($conexion);
?>