yep. here's the code that begins my scripts (nothing comes before this):
if (!empty($COOKIE['login_temp'])) {
if ('not_public_terminal' == ($COOKIE['login_temp'])) {
session_set_cookie_params(100246060, '/', 'www.godshalk.com', 1);
//echo('<p>login_temp cookie is \'not_public_terminal\', cookie params set to 100 days.</p>');
} else { // if login_temp is not FALSE
session_set_cookie_params(-100246060, '/', 'www.godshalk.com', 1);
//echo('<p>login_temp cookie is \'public_terminal\', cookie params set to 0 days.</p>');
}
} else { // if login_temp not set
session_set_cookie_params(-1002460*60, '/', 'www.godshalk.com', 1);
//echo('<p>login_temp cookie is NOT SET, cookie params set to 0 days.</p>');
}
session_start();
I print out the session cookie value and the login_temp cookie value on each page. when login_temp is false, I see this:
session cookie params are Array ( [lifetime] => 8640000 [path] => / [domain] => [secure] => )
after session start, session cookie params are Array ( [lifetime] => 8640000 [path] => / [domain] => [secure] => )
the cookie is not_public_terminal
when login_temp is true, I see this:
session cookie params are Array ( [lifetime] => -8640000 [path] => / [domain] => [secure] => )
after session start, session cookie params are Array ( [lifetime] => -8640000 [path] => / [domain] => [secure] => )
the cookie is public_terminal
(I set expiration to 100 days in the past since 0 wasn't working, but -100 days doesn't work either).
So the login_temp cookie is getting set correctly, and the session cookie is getting set correctly, but the expiration date doesn't appear to affect whether the session is preserved (or at least not in any predictable way).
I could just store the session variables as individual cookies and then when the user visits the site, update the session variables with the variables in the cookies if the login_temp cookie indicates it's a private terminal, but that seems both insecure and a kludgy solution. This is driving me insane. 🙁