diff options
-rw-r--r-- | index.php | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -35,7 +35,7 @@ define('PHPSUFFIX',' */ ?>'); // Suffix to encapsulate data in php code. | |||
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 | $cookiedir = ''; if(dirname($_SERVER['SCRIPT_NAME'])!='/') $cookiedir=dirname($_SERVER["SCRIPT_NAME"]).'/'; | 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 | session_set_cookie_params($cookie['lifetime'],$cookiedir,$_SERVER['SERVER_NAME']); // Set default cookie expiration and path. |
39 | 39 | ||
40 | // Set session parameters on server side. | 40 | // Set session parameters on server side. |
41 | define('INACTIVITY_TIMEOUT',3600); // (in seconds). If the user does not access any page within this time, his/her session is considered expired. | 41 | define('INACTIVITY_TIMEOUT',3600); // (in seconds). If the user does not access any page within this time, his/her session is considered expired. |
@@ -394,14 +394,14 @@ if (isset($_POST['login'])) | |||
394 | $_SESSION['expires_on']=time()+$_SESSION['longlastingsession']; // Set session expiration on server-side. | 394 | $_SESSION['expires_on']=time()+$_SESSION['longlastingsession']; // Set session expiration on server-side. |
395 | 395 | ||
396 | $cookiedir = ''; if(dirname($_SERVER['SCRIPT_NAME'])!='/') $cookiedir=dirname($_SERVER["SCRIPT_NAME"]).'/'; | 396 | $cookiedir = ''; if(dirname($_SERVER['SCRIPT_NAME'])!='/') $cookiedir=dirname($_SERVER["SCRIPT_NAME"]).'/'; |
397 | session_set_cookie_params($_SESSION['longlastingsession'],$cookiedir); // Set session cookie expiration on client side | 397 | session_set_cookie_params($_SESSION['longlastingsession'],$cookiedir,$_SERVER['SERVER_NAME']); // Set session cookie expiration on client side |
398 | // Note: Never forget the trailing slash on the cookie path ! | 398 | // Note: Never forget the trailing slash on the cookie path ! |
399 | session_regenerate_id(true); // Send cookie with new expiration date to browser. | 399 | session_regenerate_id(true); // Send cookie with new expiration date to browser. |
400 | } | 400 | } |
401 | else // Standard session expiration (=when browser closes) | 401 | else // Standard session expiration (=when browser closes) |
402 | { | 402 | { |
403 | $cookiedir = ''; if(dirname($_SERVER['SCRIPT_NAME'])!='/') $cookiedir=dirname($_SERVER["SCRIPT_NAME"]).'/'; | 403 | $cookiedir = ''; if(dirname($_SERVER['SCRIPT_NAME'])!='/') $cookiedir=dirname($_SERVER["SCRIPT_NAME"]).'/'; |
404 | session_set_cookie_params(0,$cookiedir); // 0 means "When browser closes" | 404 | session_set_cookie_params(0,$cookiedir,$_SERVER['SERVER_NAME']); // 0 means "When browser closes" |
405 | session_regenerate_id(true); | 405 | session_regenerate_id(true); |
406 | } | 406 | } |
407 | // Optional redirect after login: | 407 | // Optional redirect after login: |