Code with the error:
if(!empty($_GET['horarios'])){
$cod_hor=$_GET['horarios'];
}else{
header('Location:error.php');
}
if($_SESSION['tipo_pro']=='a' or $_SESSION['tipo_pro']=='p'){
$profesor=$_SESSION['ced_pro'];
$pa=mysql_query("SELECT * FROM horarios WHERE ced_pro='$profesor' and cod_hor='$cod_hor'");
if($row=mysql_fetch_array($pa)){
$oNivel=new Consultar_Nivel($row['cod_niv']);
$nombre_horario=$oNivel->consultar('nivel').'.'.$row['horario'];
}else{
header('Location:error.php');
}else{
header('Location:error.php');
}
}