I have a file that is like this:
<?php
session_start();
include("template/head.php");
include("template/header.php");
include ("inc/functions.php");
?>
<div class="content">
<?php
$password = encripta_password($_POST['loginpass']);
include ("db_files/db.php");
$strSQL = "SELECT * FROM usuarios where email = '".$_POST['loginmail']."'";
$query = mysqli_query($db, $strSQL);
while($result = mysqli_fetch_array($query)){
if ($password == $result['password'] && $_POST['loginmail'] == $result['email']){
echo "<br><center><h4>Has iniciado sesión, serás redirigido en 5 segundos</h4></center>";
$_SESSION['user']=$result['email'];
header( "refresh:5;url=index.php" );
}else {
echo "error";
}
}
mysqli_close($db);
?>
</div>
<?php
include("template/footer.php");
?>
But when I come from my form, to the page with the code mentioned above I get this error:
Warning: Can not modify header information - headers already sent by (output started at C: \ xampp \ htdocs \ oneplayer_git \ template \ header.php: 57) in C: \ xampp \ htdocs \ oneplayer_git \ logincheck.php on line 17