Forum Moderators: coopster
Warning: Cannot modify header information - headers already sent by (output started at /home/celendr1/public_html/main/other/staff.php:1) in /home/celendr1/public_html/header/header.php on line 5
I know exactly what causes this error - sending out header information after HTML information. I am just trying to code a redirect if a person is somewhere where they shouldn't be on the site. I even had to hack a method to give cookies, dear lord . . .
This is the code talking about these errors -
<?php
if (!isset($_COOKIE["userCookie"]) && $_SERVER['PHP_SELF'] != '/index2.php' && '/header/main_login.php')
{
header('Location: http://example.com/header/main_login.php');
}
((etc))
I have gone so far as to use a hex editor to check for spaces before the <?php tag, and there is none. My webserver uses us-ascii for when I want to edit code, as well.
If anyone has an IDEA about what this is about, my hat's off to them. Thanks so much! :3
[edited by: eelixduppy at 1:21 am (utc) on July 31, 2009]
[edit reason] example.com [/edit]
The code you posted is the beginning of the file? I do not see anything wrong with it here. Are you including any files anywhere that may be causing issue?
To be fair, I have been fighting this same sort of problem with the header.php for the last three days. If I can recreate it, I'll be sure and post it here, Thanks! This has been one hell of a headache for me. XD
And thanks for the welcome. <3
For future note you might want to look into output buffering [us3.php.net]. This way you won't run into this sort of error as often. :)