diff options
author | Sebastien SAUVAGE <sebsauvage@sebsauvage.net> | 2013-03-06 23:31:18 +0100 |
---|---|---|
committer | Sebastien SAUVAGE <sebsauvage@sebsauvage.net> | 2013-03-06 23:31:18 +0100 |
commit | 75e199d606438b5e7e4310e0e3da89db2acc9b54 (patch) | |
tree | e65bf96546a1c07d84c9cc71d5fe7dc33c34f62e | |
parent | 979d6334e75568fd92222ccfd6c9a3f943916d71 (diff) | |
download | Shaarli-75e199d606438b5e7e4310e0e3da89db2acc9b54.tar.gz Shaarli-75e199d606438b5e7e4310e0e3da89db2acc9b54.tar.zst Shaarli-75e199d606438b5e7e4310e0e3da89db2acc9b54.zip |
Correction for login problem with webkit browsers on sub-domain hosted Shaarli.
-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: |