So I have my main site running at / (root level), with drupal living in a subdirectory /drupal. My main web site (not yet drupal) uses sessions to store some user data. Ex:
$_SESSION['favorite_color'] = 'red';
The problem is, I want to be able to SOMEHOW access this data from my drupal module which of course lives in my drupal directory. I realize that drupal has it's own session handling system... this is fine... but how do I access data that is stored in the original PHP $_SESSION variable that drupal apparently wipes out on bootstrap?
Doing a print_r of $_SESSION on any of my normal PHP scripts shows all the saved session data, but from drupal it is empty. Any help would be greatly appreciated.
2 years 2 weeks ago
Just as a follow up, what I ended up doing was something like this in my non-drupal app:
setcookie ('old_session', $encrypted_session, (time() + 60 * 60 * 24 * 14));
Then in drupal i have all my data available in $_COOKIE so I can do this:
function hook_init() {
$decrypted_session = ...
$_SESSION = array_merge($decrypted_session, $_SESSION);
}
It works, but sure seems like 'going around my ass to get to my elbow' as they say.
I have done a ton of googling and reading and I realize that the drupal session handler is different than the standard PHP handler, thus making drupal's $_SESSION not get the $_SESSION data from my other scripts... but I need to somehow get access to my other application's $_SESSION data... it seems like there should be an easy answer, but I can't find anything that works.
KingMoore