Solved

PHP Expire Sub Domain Cookies

Posted on 2014-04-15
5
257 Views
Last Modified: 2014-05-12
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?
0
Comment
Question by:dale_abrams
  • 3
  • 2
5 Comments
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 40002883
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
 
LVL 1

Author Comment

by:dale_abrams
ID: 40032953
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
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 40032968
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
 
LVL 1

Author Closing Comment

by:dale_abrams
ID: 40059922
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
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 40060073
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

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now