Re: Cookie Problem

From: Date: Sat, 19 Apr 2003 00:52:33 +0000
Subject: Re: Cookie Problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-144454@lists.php.net to get a copy of this message
The first line of login.php is a comment, then the first acutal line of PHP code is a require() function. So cookies should be set before all of this? - Daniel "TheHeadSage" Spain theheadsage[at]manga-sketchbook[dot]org Founder of Voidsoft System Admin for The Void ----- Original Message ----- From: "John W. Holmes" <holmes072000@charter.net> To: "'The Head Sage'" <theheadsage@manga-sketchbook.org>; <php-general@lists.php.net> Sent: Saturday, April 19, 2003 10:46 AM Subject: RE: [PHP] Cookie Problem > I'm sorry, I misread the error message. Just like it says, you have > output starting on line 1 of login.php. setcookie() must be called > before any output. > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > > -----Original Message----- > > From: The Head Sage [mailto:theheadsage@manga-sketchbook.org] > > Sent: Friday, April 18, 2003 8:41 PM > > To: php-general@lists.php.net > > Subject: Re: [PHP] Cookie Problem > > > > Does that also include HTML code in variables? As i haven't displayed > > anything. > > All it is, is if statements and assigning error messages to > variables.. > > Also in function.php is the actual setcookie() function. > > > > - Daniel "TheHeadSage" Spain > > theheadsage[at]manga-sketchbook[dot]org > > > > Founder of Voidsoft > > System Admin for The Void > > ----- Original Message ----- > > From: "John W. Holmes" <holmes072000@charter.net> > > To: "'The Head Sage'" <theheadsage@manga-sketchbook.org>; > > <php-general@lists.php.net> > > Sent: Saturday, April 19, 2003 10:27 AM > > Subject: RE: [PHP] Cookie Problem > > > > > > > > But when ever i attempt to either login or logout, the cookies > wont > > > send > > > > giving me the following error > > > > > > > > <b>Warning</b>: Cannot modify header information - headers > already > > > sent > > > > by (output started at e:\htdocs\sagestower\login.php:1) in > > > > <b>e:\htdocs\sagestower\corelayout\function.php</b> on line > <b>44</b> > > > > > > I didn't read your code as this is a very common error. Searching > for > > > the key words of the error would have turned up plenty of > suggestions in > > > the archives. > > > > > > You must send all of the headers before you send any data. Cookies > are > > > included in the headers. _Any_ output is going to cause the end of > > > setting the headers, that includes any HTML or even a space. > > > > > > In function.php on line 44 you are sending some data. You are trying > to > > > set a cookie or send a header at some point after that line. It's > not > > > going to work. > > > > > > ---John W. Holmes... > > > > > > PHP Architect - A monthly magazine for PHP Professionals. Get your > copy > > > today. http://www.phparch.com/ > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

« previous php.general (#144454) next »