471,616 Members | 1,422 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,616 software developers and data experts.

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

Don
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 =----
Jul 17 '05 #1
4 1744
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

Jul 17 '05 #2
Don
On Sun, 27 Feb 2005 12:37:55 +0100, "Janwillem Borleffs" <jw@jwscripts.com> wrote:
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

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 =----
Jul 17 '05 #3
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

Jul 17 '05 #4
Don
On Sun, 27 Feb 2005 16:10:53 +0100, "Janwillem Borleffs" <jw@jwscripts.com> wrote:
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

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 =----
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Dennis Allen | last post: by
12 posts views Thread by Mike | last post: by
3 posts views Thread by Aah | last post: by
3 posts views Thread by dotnettester | last post: by
2 posts views Thread by Gerhard | last post: by
reply views Thread by leo001 | last post: by
1 post views Thread by ZEDKYRIE | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.