Setting cookie for site in http and https under different subdomains in PHP

Posted by nilacqua on Stack Overflow See other posts from Stack Overflow or by nilacqua
Published on 2010-03-17T17:37:21Z Indexed on 2010/03/17 17:41 UTC
Read the original article Hit count: 151

Filed under:
|
|

Situation: 1. I'm trying run an https store(xcart) under one domain secure.mydomain and I want to have access to a cookie it sets in http www.mydomain 2. I'm Running PHP on apache(MAMP), testing in firefox with firecookie 3. The existing code sets cookies to .secure.mydomain. I'm not sure if this is xcart related, but setcookie is actually called using secure.mydomain. I'm not sure why the "." is appended.

Problems: 1. When I try to use setcookie in https to use the domain .mydomain or just mydomain, no cookie is created, whether I'm running the store under http or https. The testing code I'm using is:

setcookie('three', 'two', 0, "/", ".mydomain");

If I set the cookie to secure.mydomain or .secure.mydomain it does show up.

Is there a reason the cookie isn't showing up?

© Stack Overflow or respective owner

Related posts about php

Related posts about cookies