Jump to content

Cookie + Protocols = Trouble


Manixat

Recommended Posts

Hello,

 

I have this problem that is bothering me. When my users log in their data is stored in cookies but say they logged in www.mydomain.com then they decide to type in the whole http://www.mydomain.com/ and they have to log in again cause there is no cookie for that "domain" ? How can I make it read cookies regardless of the beginning of url ?

Link to comment
https://forums.phpfreaks.com/topic/271203-cookie-protocols-trouble/
Share on other sites

You would specify . instead of www.

 

setcookie('user', 'badie', time()+3600*60, '/', '.mydomain.com');

 

Which would make it valid for all subdomains. Just remember, when you destroy / unset a cookie you need to supply the same path / domain. 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.