oh no! header information

A

Anonymous

Guest
why header information can't be added into certain page.I use include function
the err message as follows
can't add header info. -headers already senyt by...

here is my coding
Code:
<?php session_start(); ?>
<?php ob_start(); ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 
header("Cache-Control: post-check=0, pre-check=0", false); 
header("Pragma: no-cache"); // HTTP/1.0 
?>
<?php
$ewCurSec = 0; // Initialise

// User levels
define("ewAllowadd", 1, true);
define("ewAllowdelete", 2, true);
define("ewAllowedit", 4, true);
define("ewAllowview", 8, true);
define("ewAllowlist", 8, true);
define("ewAllowreport", 8, true);
define("ewAllowsearch", 8, true);																														
define("ewAllowadmin", 16, true);						
?>
mcm2.jpg
 
i dont see any include function.... but if you are including this after some output has been started: you are in trouble.
i would also prefere moving ob_start AFTER the headers..
 
You have to put "<?" on the first line of the script, otherwise an "enter" will be send before the php executes and headers can't be modified, because some content has allready been sent:

1 (blank line)
2 <?php session_start(); ?><?php ob_start(); ?>

should be:

1 <?php session_start(); ?><?php ob_start(); ?>
 
thats not the problem as its just an Enter after the code tag opened..
but it is also true in php codes due to the \n beeing send with each new line of the html (everything outside php code)
 
thats not the problem as its just an Enter after the code tag opened..

I disagree (or I don't understand you :) ), because the code tag "<?" is on the second line, the enter on the first..
 
put the <?php tag on the first line, before any other characters, including white spaces (newline,space and tabs).
 
what you see in the code is simply a post that looks like this:

Code:
<?php

and it results in empty line, while the following doesnt:

[code]<?php

thats all.. nothing else.. so the problem is in the way THAT file is included... as the file that includes the posted one sends header information...

It is also stupid to use lots of php tags when nothing else is outputed anyway...
 
thanks, for all ...
i thinks something err because
i didn't write include ...
may be like this
Code:
<?php
include("header.php");
?>

for every page? isn't it?[/code]
 
i found that, in this forum

when we go to profile, then
http://www.php-forum.com/p/profile.php?mode=editprofile

for private message
http://www.php-forum.com/p/privmsg.php?folder=inbox

then, what does it means by the "?" notation?
 
sarjanajava said:
i found that, in this forum

when we go to profile, then
http://www.php-forum.com/p/profile.php?mode=editprofile

for private message
http://www.php-forum.com/p/privmsg.php?folder=inbox

then, what does it means by the "?" notation?
It's mean QUERY for request of GET where all after that mean next variable=value
for example
http://www.google.com?q=php+forum
where variabe is q and equal value as php+forum.
understand?
 
Back
Top