summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--program/include/main.inc5
-rw-r--r--program/include/session.inc10
2 files changed, 12 insertions, 3 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index 9e33bae69..2d28090c7 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -57,6 +57,11 @@ function rcmail_startup($task='mail')
// load configuration
$CONFIG = rcmail_load_config();
+ // set session domain
+ if (isset($CONFIG['session_domain']) && !empty($CONFIG['session_domain'])) {
+ ini_set('session.cookie_domain', $CONFIG['session_domain']);
+ }
+
// set session garbage collecting time according to session_lifetime
if (!empty($CONFIG['session_lifetime']))
ini_set('session.gc_maxlifetime', ($CONFIG['session_lifetime']) * 120);
diff --git a/program/include/session.inc b/program/include/session.inc
index a29eabba9..9becacf00 100644
--- a/program/include/session.inc
+++ b/program/include/session.inc
@@ -172,9 +172,13 @@ function sess_regenerate_id()
sess_destroy(session_id());
session_id($random);
- $cookie = session_get_cookie_params();
- setcookie(session_name(), "", time() - 3600);
- setcookie(session_name(), $random, $cookie['lifetime'] ? time() + $cookie['lifetime'] : 0, $cookie['path']);
+
+ $cookie = session_get_cookie_params();
+ $_lifetime = $cookie['lifetime'] ? time() + $cookie['lifetime'] : 0;
+
+ setcookie(session_name(), '', time() - 3600);
+ setcookie(session_name(), $random, $_lifetime, $cookie['path'],
+ $cookie['domain']);
return true;
}