PHP Expire Sub Domain Cookies

I have control over abc.domain.com and I want to add a logout link to my site that will log users out of abc.domain.com and xyz.domain.com. Is this possible, or do I only have control over cookies from abc.com? If so, how would I expire the xyz cookie?
LVL 1
dale_abramsAsked:
Who is Participating?
 
Ray PaseurConnect With a Mentor Commented:
Subdomains are controllable. What is the actual domain you're using?  The setcookie() function has subdomain-level control.  See the "domain" argument in the online man page.  You would set this subdomain-level cookie with an expiration date/time in the past.
0
 
dale_abramsAuthor Commented:
Thanks for the response Ray. It turns out that setcookie() is not able to administrate a cookie on xyz.domain.com if the user is on abc.domain.com. The sub domains are treated as being completely different domains and browsers block the ability to cross reference other cookies.
0
 
Ray PaseurCommented:
Can you please post the SSCCE that illustrates that?  I'll be glad to test it out to see if there is a workaround.  It might be possible to remove domain.com, thereby removing both abc.domain.com and xyz.domain.com, however this might only be possible if the cookie was originally set for domain.com - a recondite conundrum.
0
 
dale_abramsAuthor Commented:
I wasn't able to get this working with your suggestion, but as the only one to attempt to help me, you deserve the points. Thanks Ray.
0
 
Ray PaseurCommented:
Why didn't you answer my requests for information?  Why did you give the worst possible grade anyone can give a fellow colleague at EE?  Please explain and tell me what you expected from me that you did not get?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.