Okewood Posted July 21, 2011 Share Posted July 21, 2011 Apologies if this has been covered before but much searching failed to find an answer. I have a site (say "www.site1.com") that uses $_SESSION variables to hold login information, which works perfectly when accessed using its own URL. I have another URL (say "www.site2.com") that my web host has redirected for me to www.site1.com and "masked", so that the www.site2.com URL is shown. Problem is, when accessing the site using the masked URL, $_SESSION doesn't hold its values between pages. Anyone come across this before? Quote Link to comment https://forums.phpfreaks.com/topic/242514-session-variables-lost-when-url-masked/ Share on other sites More sharing options...
Muddy_Funster Posted July 21, 2011 Share Posted July 21, 2011 Not personaly, but I can't imagin a situation where I would be using that kind of setup. I would expect the issue is to do with the redirect from one domain to another, it would make sense that it does not maintain a perpetual connection between pages at the end user level. You will probably need to use custom cookies to store the info on the client machine (assuming that it has cookies enabled) as a workaround. Quote Link to comment https://forums.phpfreaks.com/topic/242514-session-variables-lost-when-url-masked/#findComment-1245583 Share on other sites More sharing options...
Okewood Posted July 21, 2011 Author Share Posted July 21, 2011 I think you're right about the redirect/mask being the issue and the requirement is purely to keep a client happy (!), like you it's not something I'd choose but I'm still surprised there's almost nothing about it when searching the web. Quote Link to comment https://forums.phpfreaks.com/topic/242514-session-variables-lost-when-url-masked/#findComment-1245631 Share on other sites More sharing options...
Muddy_Funster Posted July 21, 2011 Share Posted July 21, 2011 Can't you just have the full A record for the site2.com point to the hosted space used also by site1.com, rather than the way it is set just now? Quote Link to comment https://forums.phpfreaks.com/topic/242514-session-variables-lost-when-url-masked/#findComment-1245642 Share on other sites More sharing options...
Okewood Posted July 21, 2011 Author Share Posted July 21, 2011 Possibly - and a good thought. Complicated by the fact that the redirect includes a query_string element that acts as a switch so that www.site1.com displays the relevant images to create a "skin" pertinent to the "www.site2.com" client. And of course, I store these images in those SESSION variables too, so along with not being able to log in, the graphics are all missing as well! Argghhh! Quote Link to comment https://forums.phpfreaks.com/topic/242514-session-variables-lost-when-url-masked/#findComment-1245658 Share on other sites More sharing options...
Muddy_Funster Posted July 21, 2011 Share Posted July 21, 2011 Couldn't you store the skin decision in the database with the other user credentials? - or be a bit more extreme and alocate skins by end user IP address. Quote Link to comment https://forums.phpfreaks.com/topic/242514-session-variables-lost-when-url-masked/#findComment-1245673 Share on other sites More sharing options...
Okewood Posted July 21, 2011 Author Share Posted July 21, 2011 IP address is no good becase they could use it from anywhere. DB might be an option if no-one has any solutions but the site is riddled with other information held in SESSION variables - DB request arrays, sorting, etc.etc.. Cheers anyway! Quote Link to comment https://forums.phpfreaks.com/topic/242514-session-variables-lost-when-url-masked/#findComment-1245691 Share on other sites More sharing options...
Muddy_Funster Posted July 21, 2011 Share Posted July 21, 2011 using cookies not an option? Quote Link to comment https://forums.phpfreaks.com/topic/242514-session-variables-lost-when-url-masked/#findComment-1245699 Share on other sites More sharing options...
Okewood Posted July 21, 2011 Author Share Posted July 21, 2011 May be the only option - I'll ask if their "corporate" stance is to have them allowed or not. Quote Link to comment https://forums.phpfreaks.com/topic/242514-session-variables-lost-when-url-masked/#findComment-1245734 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.