Manixat Posted November 26, 2012 Share Posted November 26, 2012 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 ? Quote Link to comment https://forums.phpfreaks.com/topic/271203-cookie-protocols-trouble/ Share on other sites More sharing options...
premiso Posted November 26, 2012 Share Posted November 26, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/271203-cookie-protocols-trouble/#findComment-1395234 Share on other sites More sharing options...
Manixat Posted November 26, 2012 Author Share Posted November 26, 2012 (edited) I don't even have those last 2 parameters, will add them and respond shortly ! EDIT: Works like a charm! Thank you! Edited November 26, 2012 by Manixat Quote Link to comment https://forums.phpfreaks.com/topic/271203-cookie-protocols-trouble/#findComment-1395236 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.