TwoSaints Posted November 14, 2011 Share Posted November 14, 2011 Hi, probably a simple solution to this which I am overlooking, doing my first foray into using cookies. So far all is well, but how do I make a cookie valid for both www.mysite.com and mysite.com if(isset($_POST['remember'][1])) { $session_id = md5($_SESSION['username'] . $_SESSION['last_login']); setcookie("session_id", $session_id, time()+60*60*24*30, "/"); } Thanks, TS Quote Link to comment https://forums.phpfreaks.com/topic/251140-setting-a-cookie-across-wwwmysitecom-and-mysitecom/ Share on other sites More sharing options...
The Little Guy Posted November 14, 2011 Share Posted November 14, 2011 I believe you should do it like this: http://phpsnips.com/snippet.php?id=62 Quote Link to comment https://forums.phpfreaks.com/topic/251140-setting-a-cookie-across-wwwmysitecom-and-mysitecom/#findComment-1288168 Share on other sites More sharing options...
TwoSaints Posted November 15, 2011 Author Share Posted November 15, 2011 Thanks, that has helped me sort it, handy website that aswell! Quote Link to comment https://forums.phpfreaks.com/topic/251140-setting-a-cookie-across-wwwmysitecom-and-mysitecom/#findComment-1288310 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.