diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -34,7 +34,8 @@ define('PHPSUFFIX',' */ ?>'); // Suffix to encapsulate data in php code. | |||
34 | 34 | ||
35 | // Force cookie path (but do not change lifetime) | 35 | // Force cookie path (but do not change lifetime) |
36 | $cookie=session_get_cookie_params(); | 36 | $cookie=session_get_cookie_params(); |
37 | session_set_cookie_params($cookie['lifetime'],dirname($_SERVER["SCRIPT_NAME"]).'/'); // Default cookie expiration and path. | 37 | $cookiedir = ''; if(dirname($_SERVER['SCRIPT_NAME'])!='/') $cookiedir=dirname($_SERVER["SCRIPT_NAME"]).'/'; |
38 | session_set_cookie_params($cookie['lifetime'],$cookiedir); // Set default cookie expiration and path. | ||
38 | 39 | ||
39 | // PHP Settings | 40 | // PHP Settings |
40 | ini_set('max_input_time','60'); // High execution time in case of problematic imports/exports. | 41 | ini_set('max_input_time','60'); // High execution time in case of problematic imports/exports. |
@@ -380,13 +381,16 @@ if (isset($_POST['login'])) | |||
380 | { | 381 | { |
381 | $_SESSION['longlastingsession']=31536000; // (31536000 seconds = 1 year) | 382 | $_SESSION['longlastingsession']=31536000; // (31536000 seconds = 1 year) |
382 | $_SESSION['expires_on']=time()+$_SESSION['longlastingsession']; // Set session expiration on server-side. | 383 | $_SESSION['expires_on']=time()+$_SESSION['longlastingsession']; // Set session expiration on server-side. |
383 | session_set_cookie_params($_SESSION['longlastingsession'],dirname($_SERVER["SCRIPT_NAME"]).'/'); // Set session cookie expiration on client side | 384 | |
385 | $cookiedir = ''; if(dirname($_SERVER['SCRIPT_NAME'])!='/') $cookiedir=dirname($_SERVER["SCRIPT_NAME"]).'/'; | ||
386 | session_set_cookie_params($_SESSION['longlastingsession'],$cookiedir); // Set session cookie expiration on client side | ||
384 | // Note: Never forget the trailing slash on the cookie path ! | 387 | // Note: Never forget the trailing slash on the cookie path ! |
385 | session_regenerate_id(true); // Send cookie with new expiration date to browser. | 388 | session_regenerate_id(true); // Send cookie with new expiration date to browser. |
386 | } | 389 | } |
387 | else // Standard session expiration (=when browser closes) | 390 | else // Standard session expiration (=when browser closes) |
388 | { | 391 | { |
389 | session_set_cookie_params(0,dirname($_SERVER["SCRIPT_NAME"]).'/'); // 0 means "When browser closes" | 392 | $cookiedir = ''; if(dirname($_SERVER['SCRIPT_NAME'])!='/') $cookiedir=dirname($_SERVER["SCRIPT_NAME"]).'/'; |
393 | session_set_cookie_params(0,$cookiedir); // 0 means "When browser closes" | ||
390 | session_regenerate_id(true); | 394 | session_regenerate_id(true); |
391 | } | 395 | } |
392 | // Optional redirect after login: | 396 | // Optional redirect after login: |