How to share session variables across Drupal sites? On my main Drupal site, users need to be able to select a display preference (e.g. 'high visibility'). This will be available to registered and anonymous users but only for their session, so I plan to store their preference in a session variable:

$_SESSION['display'] = $my_preference;


Another Drupal site runs on a subdomain of the main site, and needs the same functionality. And if the user visits both sites, it would be great to remember their preference. 

I think that if I uncomment this line in both site's settings.php, session variables can be accessed across sites on the same domain?

$cookie_domain = 'maindomain.com';


So then I could set $_SESSION['display'] on one site, and retrieve $_SESSION['display'] on the other?

Also, one site is D6 and the other D7 - will this be a problem? Is caching for anonymous users going to cause problems?

Am I on the right lines, or is this plan flawed? Thanks
There are two options to do this


Using session 


Use a single session table for both the site using settings.php set up


Using Cookie


Use same cookie domain for both site and set cookie available in all pages.