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 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 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! 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
Archived
This topic is now archived and is closed to further replies.