Originally posted by mtmosier
Usually a failed header call is accompanied by an error about headers already being outputted, and giving you line number at which output began. You didn't mention this error but I'll assume you have it.
This is usually caused by some unnoticed whitespace (spaces, newlines, whatever) at the end of one or more of your included files. First thing to do is to check out the end of all your included files to make sure that's not the problem.
If you really can't find the output in your script you can try to work around it by using the output control functions.
The warning is produced on Line 91 that simply says:
header("Location: $redirectURL");
In short, it errors on itself.
I checked and there is no embedded whitespace within any of my included files. I was told whitespace before the <? tag produces the error, anyway.
I am not sure how to use output control functions, I'm afraid, that just seems very bizarre.
Here is application.php:
error_reporting(E_ALL & ~E_NOTICE);
if ((int)ini_get('register_globals') === 1) ini_set('register_globals', false); // PROJECT-SCOPE-ONLY SHUTDOWN OF R_G TO ENSURE IVC FUNCTIONALITY
session_cache_limiter();
session_start(); // USED FOR ANY STORED SESSION VARIABLES (ONLY HAS TO BE SET HERE)
ini_set('display_errors', TRUE);
@umask(); // NEW 11/4/2004: FIX POTENTIAL PERMISSION OCTAL OFFSET PROBLEM USING PHP umask() COMMAND TO ENSURE PROPER PERMISSIONS
require_once('./include/required_libraries_launcher.inc.php');
// SPECIFICALLY FOR HANDLING THE VALIDATION AND ACTIONS PERTAINING TO THIS PAGE
require_once('./include/application_classes.inc.php');
require_once('./include/application_action.inc.php');
require_once('./include/validation_script.inc.php');
require_once('./include/actions_script.inc.php');
// TEMPLATES FOR VIEWS - USE @include_once SINCE THERE SIMPLY ARE VIEWS AND NOT ACTION-RELATED SCRIPTLETS
@include_once('./include/header.inc.php');
@include_once('./templates/application_view.php');
@include_once('./include/footer.inc.php');
That is literally the entire script. The "header()" and "die()" statements are within a condition within actions_script.inc.php:
if (!$hasValidated) { // ERROR IN PROCESSING NOT CAUGHT IN VALIDATION MODE - HANDLE HERE
$errorArray = (!is_array($errorArray)) ? $actionPerformer->getErrorArray() : $errorArray + $actionPerformer->getErrorArray();
} else { // SUCCESSFUL PROCESSING
$success = $actionPerformer->getSuccessMsg();
// "GATE-AND-KEY" METHOD TO TIE IN THE apply ACTION TO THE thankyou.php PAGE
$randString = randString(16);
$_SESSION["${projectAcronym}_key"] = $randString;
//---END OF "GATE-AND-KEY" METHOD BLOCK------------------------------------------------------
$redirectURL = 'http://' . $_SERVER['HTTP_HOST'] . "$projectURLPath/thankyou.php?section=application&randString=$randString&id=" .
$actionPerformer->id . '&mode=web&success=' . urlencode($success);
//echo "<script type=\"text/javascript\">\n<!--\n location.href='$redirectURL';\n//-->\n</script>\n<noscript>\n " .
// " <meta http-equiv=\"Refresh\" content=\"0;url=$redirectURL\">\n</noscript>\n\n";
header("Location: $redirectURL");
die();
}
Maybe if you guys can look at the code with a second pair of eyes someone will see something I don't see. Basically, there is no whitespace issue, no print_r/echo issue, nothing.
Phil