Locked Posted December 1, 2007 Share Posted December 1, 2007 Is there anyway to make sessions work across subdomains? When users visit my site they are directed to auth.site.com to login or register but when they login they use site.com but the sessions dont seem to follow with the change Quote Link to comment https://forums.phpfreaks.com/topic/79636-sessions/ Share on other sites More sharing options...
Locked Posted December 1, 2007 Author Share Posted December 1, 2007 session_set_cookie_params(120,"/",".site.co.uk",FALSE); Any idea why this wont work? Quote Link to comment https://forums.phpfreaks.com/topic/79636-sessions/#findComment-403318 Share on other sites More sharing options...
phpSensei Posted December 1, 2007 Share Posted December 1, 2007 Add this before start_session(); ini_set("session.cookie_domain", ".mydomain.com"); Quote Link to comment https://forums.phpfreaks.com/topic/79636-sessions/#findComment-403339 Share on other sites More sharing options...
toplay Posted December 1, 2007 Share Posted December 1, 2007 You found your own answer by using "." before the domain name and using just "/", however, you've only set the cookie to last 2 minutes (120 seconds). Increase this amount to something more realistic so it lasts a lot longer. http://us2.php.net/manual/en/ref.session.php#ini.session.cookie-lifetime Quote Link to comment https://forums.phpfreaks.com/topic/79636-sessions/#findComment-403340 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.