Possible Duplicate:
Headers already sent by PHP
So my website is based off of a script that includes header, pages from a folder, then the footer. I now tried to bring in a login system, but the issue is that I keep getting headers already sent. This is the code I have to make it so that if the session isnt set, redirect.
<?php
if(empty($_SESSION['user']))
{
header("Location: login.php");
die("Redirecting to login.php");
}
?>
Now am I right in saying, that the headers already sent issue, which you can see first hand here - http://www.cogameservers.com/ncms isn't this caused because the header content is already being displayed, causing headers already sent?
So I have a variable set as a $_GET variable called p for page, could I make a bunch of if else statements to make it so that if $_GET["p"] == home, then I execute the headers at the top of my header.php, being the page first called.
I'm sorry this may seem confusing, please leave requests on code you would like to see
index.php
<?php
include($_SERVER['DOCUMENT_ROOT'].'/ncms/lib/php/_dc.php');
include($_SERVER['DOCUMENT_ROOT'].'/ncms/lib/php/_ncms_fns.php');
$script = $_SERVER['SCRIPT_NAME'];
error_reporting(E_ALL);
include($_SERVER['DOCUMENT_ROOT'].'/ncms/default/header.php');
if($_GET["p"] == 'ncms' || !isset($_GET["p"])) {
include($_SERVER['DOCUMENT_ROOT'].'/ncms/pages/home.php');
} else if(file_exists($_SERVER['DOCUMENT_ROOT'].'/ncms/pages/'.$_GET["p"].'.php')) {
include($_SERVER['DOCUMENT_ROOT'].'/ncms/pages/'.$_GET["p"].'.php');
} else {
include($_SERVER['DOCUMENT_ROOT'].'/ncms/default/404.php');
}
include($_SERVER['DOCUMENT_ROOT'].'/ncms/default/footer.php');
?>
Thank you - necro.