RE: [PHP] cookie

From: Date: Wed, 04 Oct 2000 14:56:45 +0000
Subject: RE: [PHP] cookie
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-18597@lists.php.net to get a copy of this message
I don't know why it's still working, but that error means the page has already started to load when you're trying to send new header information. Where are you locating this code fragment in the file? If you haven't put it in the <head> block, you might want to try putting it there. - Mark -----Original Message----- From: Rodney Davis [mailto:rodney@wincubic.com] Sent: Tuesday, October 03, 2000 5:37 PM To: php-general@lists.php.net Subject: [PHP] cookie I have some pages that require user authentication in order to get to the page content. I have done this by switch and case statements and MySql. everything was working fine but then I decided to set a cookie and use a user_id variable the rest of the site to identify the user. When I set the cookie with the following code: //set cookie(if not set) if (!isset($user_id)){ $token = md5(uniqid(rand())); setcookie ("user_id", $token, time()+86400, "/", ".donkey.aloha-street.com"); } I get the following error Warning: Cannot add header information - headers already sent by (output started at /home/httpd/html/test/members_j.php:8) in /home/httpd/html/test/members_j.php on line 130 But the authentication still works. Does anyone know what is happening? thanks in advance rodney I am using php4 on linux. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#18597) next »