Re: [PHP] HTTP_REFERER vs. session_whatever() vs. header()

2001-01-24 Thread Richard Lynch

> //echo $test."";
> "//" .  Without the remark, the code work but I get the error message
> stating 
>
> Warning: Cannot add header information - headers already sent by
(output
> started at test.php) in test.php on line **

Yes.
A header is called a header because it comes out ahead of the actual page
content.

So what your browser *REALLY* sees is stuff like this:

Content-type: text/html
Content-length: 1035
Expiration: Jan 14 2001 20:46:37 GMT
Cookie: user_id "a7fjeju48dj934jdjcu8"


test



Note the blank line between the headers and the HTML tag.  That innocent
blank line is very, very significant.

It signifies the *END* of the headers and the beginning of the content.

So, here's the deal.  When you print something out, or have an HTML tag, or
have a blank line, PHP has to send that out as part of the Content.  Now, in
order to do that, PHP has to send out your headers first, then the blank
line, then whatever your content is.

If you later try to send out a header, using the http://php.net/header
function, or http://php.net/setcookie or http://php.net/session-start
(sessions use cookies to track users), IT IS TOO LATE.  That boat already
sailed.  Once the headers go out, and the blank line after them, you can't
get more headers to be in front of that blank line that signified the end of
the headers.

> When I put in the remark, the 2nd file, test.php couldn't use
> $GLOBAL["HTTP_REFERER"] because it couldn't find the last file.  I was
> thinking that maybe the HTTP_REFERER couldn't reach the last file because
of
> the way the header work.

What exactly are you trying to do with the referer in the 2nd file?  Print
it?  What?  Why?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] HTTP_REFERER vs. session_whatever() vs. header()

2001-01-24 Thread Scott Fletcher

Hi Everyone!

I did post the note in the past about the problem with HTTP_REFERER
which doesn't work in Netscape 6.0.  It turned out that I was looking at the
wrong thing the whole time.  What I found is that it isn't really Netscape
problem.  It turned out that Netscape 6.0 can't use 2 times at one time,
probably due to the fact that it is slower.

-
What I have in the script are ..

   $salt = strtoupper(md5(uniqid(rand())).md5(uniqid(rand(;
session_id($salt);
session_start();
session_register("user_detail");

//$test = $GLOBALS["HTTP_REFERER"];
//echo $test."";

$ask = "INSERT INTO SESSIONS
VALUES('".$PHPSESSID."','".$user_detail[USER_ID]."',CURRENT
TIMESTAMP,CURRENT TIMESTAMP,'".$REMOTE_ADDR."') ";
$result = odbc_exec($cid,$ask);
header("Location: https://www.test.org/test.php?".SID);
break;

And the 2nd file, test.php, contain the script  ...

$GLOBALS["HTTP_REFERER"];
-

When I just add the code for testing which is followed by remark code
"//" .  Without the remark, the code work but I get the error message
stating 

Warning: Cannot add header information - headers already sent by (output
started at test.php) in test.php on line **

--

When I put in the remark, the 2nd file, test.php couldn't use
$GLOBAL["HTTP_REFERER"] because it couldn't find the last file.  I was
thinking that maybe the HTTP_REFERER couldn't reach the last file because of
the way the header work.

Any solution?  Any idea?

Thanks,
 Scott



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]