Using sessions on redirect from sub-domain to main domain

I have a sub-domain ‘admin.mydomain.com’ and I want to Redirect using Header() to ‘mydomain.com’ but use Session variables to transfer information.

The Redirect works fine but only the first one of three Session variables declared in the subdomain index.php are set when the main domain index.php loads.

Has anybody experienced this before?

Is there a better way to do this? Using query string works fine but values will be on display.

Thanks in anticipation.

sessions are normally stored in cookies. In order for the cookie holding the session to be available to both the subdomain and the main domain it needs to be set on the main domain. So what you need to do is to override the domain setting for the cookie to reference the main domain rather than the subdomain when you set it on the subdomain.

(the sheer number of uses of the word ‘domain’ in that sentence made my head spin.)

Take a look at [FPHP]session_name[/FPHP] and [FPHP]set_session_cookie_params[/FPHP].

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.