Answer the question
In order to leave comments, you need to log in
How to fix an error in the paths?
My project structure
I am in the xfcategory.php file along the path adminpanel/xfcategory.php I get the
error:
: Cannot modify header information - headers already sent by (output started at C:\OpenServer\domains\xmonitoring.demo\adminpanel\xfcategory.php: 10) in
C:\OpenServer\domains\xmonitoring.demo\config\function.php on line 17
17 line from file \config\function.php
Complete function code
header("Location:../adminpanel");
if (isset($_SESSION["username"])) {
header("Location:../adminpanel");
}
// Authorization to the admin panel
if (isset($_SESSION["username"])) {
header("Location:../adminpanel");
}
<?php
session_start();
if (!isset($_SESSION["username"])) {
header("Location:../adlogin");
}
?>
Answer the question
In order to leave comments, you need to log in
The problem is not with the paths, but that your script C:\OpenServer\domains\xmonitoring.demo\adminpanel\xfcategory.php on line 10 is already outputting something to the browser. And the headers should go before any output to the browser, which php tells you about.
https://www.php.net/manual/en/function.header.php
Remember that the header() function can only be called if no data has been sent to the client yet. That is, it should come first in the output, there should not be any HTML tags, empty lines, etc. before it is called...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question