Re: Setting cookies

From: Date: Tue, 30 Sep 2003 18:03:08 +0000
Subject: Re: Setting cookies
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-164430@lists.php.net to get a copy of this message
--- Chris Boget <chris@wild.net> wrote: > We have 2 servers, one for development and one for production. The > development server is "dev.change.wild.net" while the production server > is "change.wild.net". We are using the following code to set the cookie > > $expire_time = time()+60*60*24*30; // 30 days > setcookie( 'this', $this, $expire_time, '/', > $_SERVER['HTTP_HOST'] ); > setcookie( 'that', $that, $expire_time, '/', > $_SERVER['HTTP_HOST'] ); > > We are accessing the cookie values using $_COOKIE. What appears to > be happening is that when we echo the values of the above cookies on > "dev.change.wild.net", it is displaying the values set for on > "change.wild.net". > Why is that? Because dev.change.wild.net is within the change.wild.net domain. This is by design. They are not different domains. You can always use: 1. dev.change.wild.net 2. www.change.wild.net or 1. change-dev.wild.net 2. change.wild.net Hope that helps. Chris ===== HTTP Developer's Handbook http://shiflett.org/books/http-developers-handbook My Blog http://shiflett.org/

« previous php.general (#164430) next »