Re: read the main domain cookie in sub domain

From: Date: Tue, 18 Sep 2007 19:15:38 +0000
Subject: Re: read the main domain cookie in sub domain
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-262216@lists.php.net to get a copy of this message
Sanjeev N wrote:
I did it. Still I am not able to access it.
You'll probably need to delete the existing cookie from your browser and get it set again. -Stut
-----Original Message----- From: Stut [mailto:stuttle@gmail.com] Sent: Wednesday, September 19, 2007 12:41 AM To: Sanjeev N Cc: php-general@lists.php.net Subject: Re: [PHP] read the main domain cookie in sub domain Sanjeev N wrote:
Assume, I have www.domain.com <http://www.domain.com/> in which I wrote
the
functionality for user authentication and his profile related
functionality.
Now, when user logs in using http://www.domain.com/users/login.php then after his successful login a session as well as a cookie is getting
created.
This will creates a cookie called myCookie123 Now I have my subdomain as http://sub.domain.com/index.php . here at the
top
I am checking whether the user is logged in or not, for that I have to
check
whether the cookie is created or not.. Here my problem is that, I am not getting the idea about, how to access or read the cookie of http://www.domain.com <http://www.domain.com/> from http://sub.domain.com/. can anyone please suggest me how to achieve this.
Set the $domain parameter of setcookie to '.domain.com'. -Stut


« previous php.general (#262216) next »