PDA

View Full Version : online.php header problem


tkeil69575
05-02-2002, 11:31 AM
Hi all,

i have the following parse error showing up from time to time. Its not always there though and I cant really simulate it. Sometimes it just goes away if I call up online.php again, but its bugging me badly.

Warning: Cannot add header information - headers already sent by (output started at /home/blabal.../forums/online.php:2) in /home/blabla.../forums/admin/functions.php on line 1601

Line 1601 in functions.php looks like this:

1597 if ($cookiedomain) {
1598 setcookie($name, $value, $expire, $cookiepath,
1599 $cookiedomain, $secure);
1600 } else {
1601 setcookie($name, $value, $expire, $cookiepath, '', $secure);
1602 }

Any of you have an idea what might be causing this?

regards Tina

Admin
05-02-2002, 11:33 AM
What the second line of online.php? Could it be online.php looks like this:
1:
2:
3: <?php
4: error_reporting(7);
(i.e you have blank lines at the top)

tkeil69575
05-02-2002, 11:37 AM
Hi Chen,

well yes 1 blank line before <?php.


2: <?php
3:
4: // Yes we realize that there are a lot of hard coded English words in this file.
5: // Language abstraction is planned for vB v3.0
6:
7: error_reporting(7);


sorry, had another look, jus now. Guess that the bug?

Sparkz
05-02-2002, 11:42 AM
That looks about right...

Could it be the setcookie()-function that fails for some reason and produces some kind of error output?

tkeil69575
05-02-2002, 11:56 AM
Hi Sparkz,

thanks for the reply. Well, yes that was my first thought, but somehow I doubt it because of the Warning regarding the header. I mean what has the cookiesetting to do with the header warning.

According to my understanding of line 1601, this comes into effect if I dont have my domainname set as the cookiepath in the adminsettings of my board, which I havent because I'm only running one board on the server, thus having that set to "/".

mmh. well I've removed the blank line before <?php now - maybe that was it ? Was that what your where trying to tell me Chen?

Tina :)

Sparkz
05-02-2002, 12:11 PM
If some function fails and this causes any kind of output to be sent, you cannot send any more headers afterwards.

But having blank lines before <?php could also cause it.

Admin
05-02-2002, 12:42 PM
Having the blank line actually sent a blank line to the browser, as output. And as we all know, you can't send HTTP headers after you start sending output to the browser, and since setcookie() sends a header - it failed.

tkeil69575
05-02-2002, 12:43 PM
Hi Sparks, Hi Chen,

ok, thanks for explaining. :)

looks like the problem is solved now. Thanks again to both of you!

regards Tina

Dio Br@ndo
11-10-2002, 01:46 PM
Thx for explaining! :)