alexville Posted August 31, 2008 Share Posted August 31, 2008 Hey guys, This problem has bugged me for the longest time and I thought you guys could take me out of my misery. The thing is, I have a php login script. The one from http://www.evolt.org/node/60384 And when a user logins into my site at the url and clicks remember me: alexville.com (without the www.) the new url after login is www.alexville.com. But when they close their browser or just even go to alexville.com (without the www.) again they are not logged in. This is probably a simple fix, and probably easier for someone that already knows this login script. Could someone give me a fix for this, because I am losing my mind!!! ??? ??? ??? ??? ??? ??? ??? Link to comment https://forums.phpfreaks.com/topic/122105-solved-php-session-variables-lose-their-values-between-subdomains/ Share on other sites More sharing options...
alexville Posted August 31, 2008 Author Share Posted August 31, 2008 bump Link to comment https://forums.phpfreaks.com/topic/122105-solved-php-session-variables-lose-their-values-between-subdomains/#findComment-630435 Share on other sites More sharing options...
DarkWater Posted August 31, 2008 Share Posted August 31, 2008 You need to play around with the session cookie's domain parameter in your php.ini, because as far as your browser knows, they're two separate domains unless you tell it otherwise. Link to comment https://forums.phpfreaks.com/topic/122105-solved-php-session-variables-lose-their-values-between-subdomains/#findComment-630437 Share on other sites More sharing options...
alexville Posted August 31, 2008 Author Share Posted August 31, 2008 You need to play around with the session cookie's domain parameter in your php.ini, because as far as your browser knows, they're two separate domains unless you tell it otherwise. The thing is, i'm on free hosting. So, is there some other way to do this? Or what should I tell my web hoster? Link to comment https://forums.phpfreaks.com/topic/122105-solved-php-session-variables-lose-their-values-between-subdomains/#findComment-630438 Share on other sites More sharing options...
DarkWater Posted August 31, 2008 Share Posted August 31, 2008 Pay for hosting then, because 99.99% of all free hosting ends up being crap. You get what you pay for. Link to comment https://forums.phpfreaks.com/topic/122105-solved-php-session-variables-lose-their-values-between-subdomains/#findComment-630442 Share on other sites More sharing options...
alexville Posted August 31, 2008 Author Share Posted August 31, 2008 Pay for hosting then, because 99.99% of all free hosting ends up being crap. You get what you pay for. Thats not completely true. Even If I bought hosting, I still couldn't change the php.ini file because its on a shared server. Link to comment https://forums.phpfreaks.com/topic/122105-solved-php-session-variables-lose-their-values-between-subdomains/#findComment-630444 Share on other sites More sharing options...
Psycho Posted August 31, 2008 Share Posted August 31, 2008 Add this before session_start() [usiong your parameters]: ini_set("session.cookie_domain", ".mydomain.com"); http://www.madcarrot.co.uk/2005/08/pass_sessions_b.html Link to comment https://forums.phpfreaks.com/topic/122105-solved-php-session-variables-lose-their-values-between-subdomains/#findComment-630447 Share on other sites More sharing options...
alexville Posted August 31, 2008 Author Share Posted August 31, 2008 Never mind, solved the problem by automatically redirecting all alexville.com traffic to www.alexville.com using Cpanel Link to comment https://forums.phpfreaks.com/topic/122105-solved-php-session-variables-lose-their-values-between-subdomains/#findComment-630448 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.