Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PHP Expire Sub Domain Cookies

Posted on 2014-04-15
5
Medium Priority
?
282 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 1000 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 111

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 111

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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Progress
Suggested Courses

610 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