Re: cookie

From: Date: Wed, 04 Oct 2000 06:35:54 +0000
Subject: Re: cookie
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-18534@lists.php.net to get a copy of this message
Hello Rodney, Wednesday, October 04, 2000, 2:37:13 AM, you wrote: RD> I have some pages that require user authentication in order to RD> get to the page content. I have done this by switch and case statements RD> and MySql. everything was working fine but then I decided to set a cookie RD> and use a user_id variable the rest of the site to identify the user. When RD> I set the RD> cookie with the following code: RD> //set cookie(if not set) RD> if (!isset($user_id)){ RD> $token = md5(uniqid(rand())); RD> setcookie ("user_id", $token, time()+86400, "/", RD> ".donkey.aloha-street.com"); RD> } RD> I get the following error RD> Warning: Cannot add header information - headers already sent by (output RD> started at /home/httpd/html/test/members_j.php:8) in RD> /home/httpd/html/test/members_j.php on line 130 RD> But the authentication still works. RD> Does anyone know what is happening? RD> thanks in advance RD> rodney RD> I am using php4 on linux. Header must be sent to a client on the begining. Before anything sent to a browser -- Best regards, Daniel mailto:daniel@mail.viapvt.sk

« previous php.general (#18534) next »