Possible Duplicate:
“Warning: Headers already sent” in PHP
My bamfg_functions.php code:
<?php
error_reporting(E_ALL & ~E_NOTICE);
define('THIS_SCRIPT', 'test');
define('CSRF_PROTECTION', true);
require_once('global.php');
function bamfg_navigation()
{
global $vbulletin;
if ($vbulletin->userinfo['userid']) {
$navigation .= "<center>- Browse Vehicles - <a href='./bamfg.php'>Search Vehicles</a> -<br>- <a href='./bamfg_vehicle.php'>ADD / EDIT Vehicles</a><br><br> </center>";
}
else {
$navigation .= "<center>- Browse Vehicles - <a href='./bamfg.php'>Search Vehicles</a> -<br><br></center>";
}
return $navigation;
}
?>
This is how I am including the bamfg_functions.php into my bamfg_vehicle.php file.
require('bamfg_functions.php');
bamfg_navigation = bamfg_navigation();
global $bamfg_navigation;
Here is one of my many do== statements within bamfg_vehicle.php that is effected..
if($_REQUEST['do'] == 'add_comment') {
$userid = $vbulletin->userinfo['userid'];
$username = $vbulletin->userinfo['username'];
$vbulletin->input->clean_gpc('r', 'id', TYPE_INT);
$vehicle_id = $vbulletin->GPC['id'];
$owner_userid = $_GET["owner_userid"];
// ** THIS GETS THE "POSTED" INFORMATION FROM THE PAGE AND CONVERTS TO VARIABLE - CLEANS INPUT
$vbulletin->input->clean_array_gpc('p', array(
'comment' => TYPE_NOHTML,
));
$comment = $vbulletin->GPC['comment'];
// MAKES SURE THE COMMENT ISN'T BLANK
if (strlen($comment) == 0){
Header( "Location: $website_url/bamfg_vehicle.php?do=view_vehicle& id=$vehicle_id" );
}
else {
$sql = "INSERT INTO ". TABLE_PREFIX ."BAMFG_comment (
comment_id,
vehicle_id,
userid,
owner_userid,
username,
comment) VALUES (
'". $comment_id ."',
'". $vehicle_id ."',
'". $userid ."',
'". $owner_userid ."',
'". $username ."',
'". $comment ."')";
$db->query_write($sql);
Header( "Location: $website_url/bamfg_vehicle.php?do=view_vehicle&id=$vehicle_id" );
}}
My issue is when I "require" the bamfg_functions.php file it breaks all my header redirects, I've also tried require_once(bamfg_functions.php); and just include(bamfg_functions.php); with the same result..
As soon as I comment out the line that calls the file, the header redirects work and it's driving me nuts..
I realize the header redirects only work if there is no data outputted to the browser before it is called, but I don't see that anywhere?
Any advice would be awesome, thanks..