cookie
| From: | Rodney Davis | Date: | Wed, 04 Oct 2000 00:37:13 +0000 |
| Subject: | cookie | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-18500@lists.php.net to get a copy of this message | ||
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.