The Page is not redigating properly

0

I explain here they have helped me to do a controlled login at the moment everything is fine to some extent when adding security.php to the index of the module tells me the browser that is redirecting wrong I do not know because if it has the correct path this is my code

Login.php

<?php



	$correo=$_POST['correo'];
	$clave=md5($_POST['clave']);
	require_once('Conexion.php');
	$conn = Conectar();

	$stmt = $conn->prepare("SELECT  id_usuario, nombre, apellido, correo, p.id_perfil, perfil FROM usuario u INNER JOIN perfil p ON p.id_perfil=u.id_perfil WHERE u.correo=:correo AND u.clave=:clave");
	$stmt->bindParam(':correo',$correo);
	$stmt->bindParam(':clave',$clave);
	$stmt->execute();
	
	
	if($stmt->rowCount()>=1){
		session_start();
		$fila=$stmt->fetch();
		if($fila['id_perfil']==1)
			{header("Location: administrador/index.php");}
		if($fila['id_perfil']==2)
			{header("Location: aprendiz/index.php");}
		if($fila['id_perfil']==3)
			{header("Location: root/index.php");}
	}
	else{
		 echo "<font color='red'>Datos No Validos</font>";
	}

	


?>	

Seguridad.php

<?php
	session_start();
	if(!isset($_SESSION['id_perfil'])==1){
		header("Location: index.php");
	}
	

when removing security.php from the index of the module it enters normal but it is not something that I want since if I remove it anybody with knowing its url can enter how can I solve this and thank you

    
asked by Zen 22.08.2017 в 17:41
source

1 answer

0

If you could upload a screenshot of the error or something that explains better the question would be good, for now try adding the following to the beginning and end of the code:

   ob_start();
    //TU CODIGO FUENTE
   ob_end_flush();
    
answered by 22.08.2017 в 20:26