note 54548 added to function.setcookie
| From: | p dot nowicki at hero dot mac dot edu dot pl | Date: | Thu, 07 Jul 2005 16:03:26 +0000 |
| Subject: | note 54548 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91599@lists.php.net to get a copy of this message | ||
It takes me some time to solve a problem with PHPSESSID propagation in URL's when
--enable-trans-sid is on.
The problem was that even when user has cookies turned on, sometimes PHPSESSID has been shown in
URL. I used subdomains on my page to make the URL's more user-friendly.
It turn out that the session cookie was automaticly set to main domain address with "www"
(ex. "www.domain.top_domain"), when session.cookie_domain was set to (default value)
"no value".
Adding
<?php
ini_set("session.cookie_domain", ".domain.top_domain");
?>
helped, and now when session cookie is set, all URL's are clear from the nasty session id.
Right now it seems to be pretty logical, but sometimes you can easly forget about something like
that.
----
Manual Page -- http://www.php.net/manual/en/function.setcookie.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54548
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54548&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54548&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54548&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54548&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54548&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54548&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54548&report=yes
Search -- http://master.php.net/manage/user-notes.php