0

I have a subdomain that users log into (my.domain-uk.net) which stores a session variable to say that the user is logged in. The variable looks like:

$_SESSION["domain-uk.net"]["customer_loggedin"] = 'yes';

when i echo this on any page in the my. subdomain it displays 'yes' but as soon as i go back to the main domain (domain-uk.net) and echo the variable it doesn't show anything

i have session_start(); on every page

user2710234
  • 3,177
  • 13
  • 36
  • 54

1 Answers1

2

In your .htaccess you can set your session cookie domain to the base.

php_value session.cookie_domain ".domain-uk.net"

You can also do this inside of your application:

<?php 
session_set_cookie_params(0, '/', '.domain-uk.net'); 
session_start(); 
?>
David H. Bennett
  • 1,822
  • 13
  • 16