I am trying to load a page when I pass the control of the login before I did it but now I do not load it and I do not know what is the code. This is the PHP code
<?php
session_start();
include ("conex.php");
$usuario = $pass = "";
$html = 0;
if ($_SERVER["REQUEST_METHOD"] == "POST"){
$usuario = mysqli_real_escape_string($con,$_POST['user']);
$pass = mysqli_real_escape_string($con,$_POST['pwd']);
$sql = "SELECT id_congregacion, nombre_hermano, apellido_hermano FROM hermanos WHERE user = '$usuario' AND pass = '$pass'";
$result = mysqli_query($con, $sql);
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
if (mysqli_num_rows($result) >= 1){
$_SESSION['login_user'] = $row['nombre_hermano']." ".$row['apellido_hermano'];
$_SESSION['congregacion'] = $row['id_congregacion'];
header("Location: ../html/inicio.html");
mysqli_free_result($result);
}else{
$html = 1;
}
}
echo $html;
mysqli_close($con);
?>
<?php
define ("DB_SERVER","localhost");
define ("DB_USER_NAME","id4671277_root");
define ("DB_PASSWORD","1234abcd");
define ("DB_DATABASE","id4671277_controltajetas");
$con = mysqli_connect(DB_SERVER,DB_USER_NAME,DB_PASSWORD,DB_DATABASE);
if (!$con){
echo"Error: no se pudo conectar con MySQL." . PHP_EOL;
echo "errno de depuración: " . mysqli_connect_errno() . PHP_EOL;
echo "error de depuración: " . mysqli_connect_error() . PHP_EOL;
exit;
}
?>
When you test the variable $ html returns 0 which means you found a data and should load the home page I leave some images to see that it comes out.
As you can see, it loads the code but it does not show me the page, I do not know why this happens, I really appreciate your help.