aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSébastien SAUVAGE <sebsauvage@sebsauvage.net>2013-03-08 01:01:40 -0800
committerSébastien SAUVAGE <sebsauvage@sebsauvage.net>2013-03-08 01:01:40 -0800
commit41a30d9b2dd6321e231ccc8b40d2f038e6aa5bb8 (patch)
treee65bf96546a1c07d84c9cc71d5fe7dc33c34f62e
parent979d6334e75568fd92222ccfd6c9a3f943916d71 (diff)
parent75e199d606438b5e7e4310e0e3da89db2acc9b54 (diff)
downloadShaarli-41a30d9b2dd6321e231ccc8b40d2f038e6aa5bb8.tar.gz
Shaarli-41a30d9b2dd6321e231ccc8b40d2f038e6aa5bb8.tar.zst
Shaarli-41a30d9b2dd6321e231ccc8b40d2f038e6aa5bb8.zip
Merge pull request #37 from sebsauvage/CookieDomain
Correction for login problem with webkit browsers on sub-domain hosted Shaarli.
-rw-r--r--index.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/index.php b/index.php
index 1babe952..8e90f9ab 100644
--- a/index.php
+++ b/index.php
@@ -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"]).'/';
38session_set_cookie_params($cookie['lifetime'],$cookiedir); // Set default cookie expiration and path. 38session_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.
41define('INACTIVITY_TIMEOUT',3600); // (in seconds). If the user does not access any page within this time, his/her session is considered expired. 41define('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: