Hello, I have the following code:
<?php
session_start();
require_once('conecta.php');
$email = sha1($_POST['email']);
$senha = $_POST['senha'];
$sql = "SELECT * FROM dados WHERE email = '$email' AND senha = '$senha'";
$objDb = new db();
$link = $objDb->conecta_mysql();
$resultado = mysqli_query($link, $sql);
if ($resultado) {
$dados = mysqli_fetch_array($resultado);
if (isset($dados['email'])) {
$_SESSION['email'] = $dados["email"];
$_SESSION['nome'] = $dados["nome"];
header('Location: indexVol.php');
} else {
header('Location: entrar.php?erro=1');
}
} else {
echo 'Erro na execução da consulta, favor entrar em contato com o admin do site';
}
?>
But when I try to log in, it goes straight to header('Location: entrar.php?erro=1');
, as if the database did not have the email and registered password, but it does. Does anyone have any idea what might be wrong? I know the code is not sure sql injection, but this is just a test for me to understand.
Note: The page is hosted in locaweb.com
, I do not know if mysqli_fetch_array
is available for use, because Xampp works normally!