For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > February 2005 > Accessing cookies after domain has been mapped to another domain/folder









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Accessing cookies after domain has been mapped to another domain/folder
Don

2005-02-27, 3:56 am

I had my host map "domainA.com" to folder "domainB.com/folder". I'm finding when accessing
"domainA.com" that PHP scripts which utilize $_COOKIE[] aren't able to see the cookies belonging to
"domainA.com". However, JavaScript scripts can see the cookies via "document.cookie". So far, the
only way I've found to deal with this is to redirect all access to "domainA.com/index.html" to
"domainB.com/remappedindex.html". Any ideas on a better, more straight forward way to do deal with
this?

Thanks,
Don

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Janwillem Borleffs

2005-02-27, 8:56 am

Don wrote:
> I had my host map "domainA.com" to folder "domainB.com/folder". I'm
> finding when accessing "domainA.com" that PHP scripts which utilize
> $_COOKIE[] aren't able to see the cookies belonging to "domainA.com".
> However, JavaScript scripts can see the cookies via
> "document.cookie". So far, the only way I've found to deal with this
> is to redirect all access to "domainA.com/index.html" to
> "domainB.com/remappedindex.html". Any ideas on a better, more
> straight forward way to do deal with this?
>


When you are setting the cookie through the setCookie() function, use the
"/" as the fourth "path" argument.

When setting the cookie through a header call, be sure to append the
"path=/" string.


JW



Don

2005-02-27, 8:55 pm

On Sun, 27 Feb 2005 12:37:55 +0100, "Janwillem Borleffs" <jw@jwscripts.com> wrote:

>Don wrote:
>
>When you are setting the cookie through the setCookie() function, use the
>"/" as the fourth "path" argument.
>
>When setting the cookie through a header call, be sure to append the
>"path=/" string.
>
>
>JW
>
>

I believe I'm doing that. Here's the statement I'm using. Any other ideas?

document.cookie = "cpceCtrlPanelFuncsCookie=" + cpceCtrlPanelFuncsCookieStrPartial + "; expires=Wed,
01-Jan-2014 00:00:01 GMT; path=/";

Thanks,
Don

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Janwillem Borleffs

2005-02-27, 8:55 pm

Don wrote:
> document.cookie = "cpceCtrlPanelFuncsCookie=" +
> cpceCtrlPanelFuncsCookieStrPartial + "; expires=Wed, 01-Jan-2014
> 00:00:01 GMT; path=/";
>


This is a javascript cookie which, especially in IE, is assigned merely as a
property of the document object when stuff goes wrong (you can check if the
cookie was set successfully by alerting the cookie and verifying that only
the cookie name and value are shown).

Try to set the cookie with PHP instead and see what happens.


JW



Don

2005-02-28, 3:56 pm

On Sun, 27 Feb 2005 16:10:53 +0100, "Janwillem Borleffs" <jw@jwscripts.com> wrote:

>Don wrote:
>
>This is a javascript cookie which, especially in IE, is assigned merely as a
>property of the document object when stuff goes wrong (you can check if the
>cookie was set successfully by alerting the cookie and verifying that only
>the cookie name and value are shown).
>
>Try to set the cookie with PHP instead and see what happens.
>
>
>JW
>
>

Thanks for the suggestion JW. But, given the nature of what I'm doing in the page, I have to set it
via JS. I have a feeling there's no way around remapping the domain.

Thanks for your help.
Don

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com