I've got a strange issue with some code giving me
Warning: Cannot modify header information - headers already sent by I have this code at the top of every page but it is only giving me this error on one particular page. If I copy the code into a new file (test.php) it works perfectly, just like the other pages.
Here is the code thats driving me mad:
<?php
session_start();
error_reporting(E_ALL); ini_set('display_errors', '1');
require_once('includes/config.php');
if (!isset($_SESSION['user_id'])) {
header('Location: error-402.php');
} else if (!$scrap_cars) {
header('Location: error-401.php');
}
include('includes/functions.php');
?>
When a user logs in, it sets a session called "user_id". In config.php there is $scrap_cars variable, this is set to either true or false.
As you'll see the basic idea of the code is, if you're not logged in then redirect to "Not logged in page" but if you are logged in and $scrap_cars variable is set to false then redirect to "You don't have access page".
I have checked for whitespace everywhere, removed all the content so the erroneous page mimics (test.php) but all to no avail.
Please help.......