CodeIgniter Forums
sessions and subdomains - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: sessions and subdomains (/thread-53158.html)



sessions and subdomains - El Forum - 07-12-2012

[eluser]aeternuslibertas[/eluser]
Hi all I have a quick question, I currently set up a very simple login/members area using the session class.
I'm also using a sub domain as a flag to switch between languages. For example, mywebsite.com automatically loads everything in the english language, however if I point my browser spanish.mywebsite.com it triggers everything to fetch the respective spanish language files ( also within code igniter.. so there is only one controller/view page per page, all the language switching is done with the codeigniter language folder). My problem is that when I log in either through the mywebsite.com or spanish.mywebsite.com/ the session does not allow me to switch between languages without requesting me to login again.
Is the cookie that is created by the session class use URL data to validate it self or do you guys think it is a bug in my code or perhaps code igniters code? Smile thank you in advance


sessions and subdomains - El Forum - 07-12-2012

[eluser]CroNiX[/eluser]
Quote:Is the cookie that is created by the session class use URL data to validate it self
Not that I know of. I would guess it has to do with the $config['cookie_domain'] setting, although I haven't checked to see if the session cookies use these values (I assume they would). To use domain-wide, you'd need to make the cookie domain like ".yoursite.com" with a . in front. Then it should work on yoursite.com, www.yoursite.com, es.yoursite.com or whatever.

You can use firebug/firecookie or webkits debugger to see the names, values, domain, expiration, etc, of the cookies to see if they are being set correctly.


sessions and subdomains - El Forum - 07-12-2012

[eluser]aeternuslibertas[/eluser]
[quote author="CroNiX" date="1342147549"]
Quote:Is the cookie that is created by the session class use URL data to validate it self
Not that I know of. I would guess it has to do with the $config['cookie_domain'] setting, although I haven't checked to see if the session cookies use these values (I assume they would). To use domain-wide, you'd need to make the cookie domain like ".yoursite.com" with a . in front. Then it should work on yoursite.com, www.yoursite.com, es.yoursite.com or whatever.

You can use firebug/firecookie or webkits debugger to see the names, values, domain, expiration, etc, of the cookies to see if they are being set correctly.[/quote]

WOW I TOTALLY OVERLOOKED THAT SETTING. THANK YOU VERY MUCH. Problem Fixed!