Re: Error message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You have a real attitude problem, please don't bother with me again.


"Jochem Maas" <jochem@xxxxxxxxxxxxx> wrote in message news:48D2E006.5030902@xxxxxxxxxxxxxxxx
Terry J Daichendt schreef:
I'm pasting this code from the example at php.net and getting these

which example might that be, with 1000's of built in functions you
can imagine there is probably more than one.

errors. Can anyone determine what I'm doing wrong?


yes. but can your read? the error message tells you what is wrong.

"output started at /home/terryswe/public_html/hisdailybread/session.php:6"

basically the body of a http request must come after the http headers,
sessions make use of cookies. the first echo (or print) statement effectively starts the output of the http request body after which no headers can be sent
anymore.

what is also plainly obvious is that the example code you posted is *NOT*
the code your trying to run:

there is no session_start() called on line 9 in the example you gave.

<?php
// page1.php

session_start();

echo 'Welcome to page #1';

$_SESSION['favcolor'] = 'green';
$_SESSION['animal']   = 'cat';
$_SESSION['time']     = time();

// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';

// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';

don't bother with the above line, it's shite. which is a
short way of saying that you have no idea as to the security
ramifications so best not to even go there.

?>


Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/terryswe/public_html/hisdailybread/session.php:6) in /home/terryswe/public_html/hisdailybread/session.php on line 9

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/terryswe/public_html/hisdailybread/session.php:6) in /home/terryswe/public_html/hisdailybread/session.php on line 9
Welcome to page #1

Terry





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux