<?php
require_once("banco-produtos.php");
require_once("logicaUsuario.php");
verificaUsuario();
require_once("header.php");
$id = $_POST['id'];
removeProduto($conexao, $id);
$_SESSION["success"] = "Produto removido com sucesso";
header("Location:estoque.php");
die();
LogicaUsuario.php
function verificaUsuario(){
if (!usuarioEstaLogado()){
$_SESSION["error"] = "Você não tem acesso a essa funcionalidade";
header("Location:index.php");
die();
};
};
bank-products.php
require_once("conexao.php");
function removeProduto($conexao, $id){
$query = "delete from produtos where id = {$id}";
return mysqli_query($conexao, $query);
};
Error_log
Warning: Cannot modify header information - headers already sent by (output started at /home/comunica/public_html/testes/murilo/phpI/header.php:23) in /home/comunica/public_html/testes/murilo/phpI/remove-produto.php on line 11
I followed the tips given in two other questions, one of mine and one that had been marked as a duplicate of the previous one, but none of them solved my problem, I modified the code as many times as possible, tried to put header()
or user verification.