0

I'm currently working on a system that allows a login over multiple subdomains. Unfortunately all methods i've tried of transferring the UID session (of which the account ID is stored) over does not work. The problem i would like to solve is transferring $_SESSION['UID']; from its login location at account.domain.co.uk to domain.co.uk. I do not however want this session to pass through to all subdomains, just the main domain and account.domain.com. I have a file named init.php which is called before anything else. At the moment the file looks like this:

> // -- initialization file -- //
> 
> if ($_SERVER[HTTP_HOST] === 'account.domain.co.uk' || $_SERVER[HTTP_HOST] === 'domain.co.uk') {
> session_name('some_name');    
> session_set_cookie_params(0, '/', 'domain.co.uk'); 
> }
> 
> session_start();

The original session is set at account.domain.co.uk. I have also tried:

ini_set('session.cookie_domain', '.domain.co.uk');

but unfortunately that doesn't work either.

All help to get this working will be greatly appriciated, and if any additional information is needed i will be happy to supply. Thanks!

EDIT 1 - Bump for response?

MyiWorld
  • 51
  • 1
  • 8
  • You can append the session vars as variables to the url or use js for the cross-domain functionality. Take a further look at here. It is good explained http://stackoverflow.com/questions/14611545/preserving-session-variables-across-different-domains – Dimitar Stoyanov Oct 31 '15 at 13:09
  • Hi i've already done that with a NONCE autentication system using GET variables. However it makes it annoying to create a log out system as you have to session_destroy() more sessions. This way would provide one convenient session to easily be destroyed. Also as it is only one major domain that sessions are being communicated through surely a cross-domain transfer isn't needed. Thanks for taking the time to answer though. – MyiWorld Oct 31 '15 at 13:11

0 Answers0