note 25606 rejected from function.setcookie by nicos
| From: | nicos@php.net | Date: | Mon, 30 Sep 2002 12:20:43 +0000 |
| Subject: | note 25606 rejected from function.setcookie by nicos | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-37423@lists.php.net to get a copy of this message | ||
PROBLEM: ONLY 1 COOKIE CAN BE SET
sample code:
<?php
...
SetCookie ( "app1_session", $encoded_login, time() + ( 24 * 3600 * 365 ), $cookie_path );
//die("stop after setting first cookie");
SetCookie ( "app1_login", $login, time() + ( 24 * 3600 * 365 ), $cookie_path );
...
?>
What happens: The cookie app1_session is overwritten by the cookie app1_login !
Tested: If we put a die() statement right after the SetCookie statement that writes the app1_session
cookie to the client, it will result in having a cookie app1_session.
Now if we remove the die() statement and run the script again it will result in ONLY a app1_login
cookie.
Also tested: If we remark (deactivate) the line where the SetCookie command is executed to write the
app1_login cookie, the script will result in ONLY the app1_session cookie being there.
Can anyone please help or provide an alternative ?
Config: win98, apache, php 4.2.3, IE5.x