diff options
author | chrisaga <chrisaga@piwigo.org> | 2006-07-08 09:31:09 +0000 |
---|---|---|
committer | chrisaga <chrisaga@piwigo.org> | 2006-07-08 09:31:09 +0000 |
commit | 6653314edc728548913dc18cfcacd3455a354ee5 (patch) | |
tree | 2df6bf01d07eba70447853cd5c7d0117e4d0bd92 /include/functions_session.inc.php | |
parent | 5dcc4de9f360817cb8320f5643ccc38e9f026795 (diff) |
merge from trunk r14441:1442 into branch 1.6 (fix bug 458 : wrong path in sesion cookie)
git-svn-id: http://piwigo.org/svn/branches/branch-1_6@1443 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_session.inc.php')
-rw-r--r-- | include/functions_session.inc.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/include/functions_session.inc.php b/include/functions_session.inc.php index 9768bf927..8765028ae 100644 --- a/include/functions_session.inc.php +++ b/include/functions_session.inc.php @@ -84,7 +84,12 @@ if (isset($conf['session_save_handler']) // cookie_path will return : "/meeting/gallery" function cookie_path() { - if ( isset($_SERVER['REDIRECT_URL']) ) + if ( isset($_SERVER['REDIRECT_SCRIPT_NAME']) and + !empty($_SERVER['REDIRECT_SCRIPT_NAME']) ) + { + $scr = $_SERVER['REDIRECT_SCRIPT_NAME']; + } + else if ( isset($_SERVER['REDIRECT_URL']) ) { // mod_rewrite is activated for upper level directories. we must set the // cookie to the path shown in the browser otherwise it will be discarded. if ( isset($_SERVER['PATH_INFO']) and !empty($_SERVER['PATH_INFO']) ) @@ -108,7 +113,9 @@ function cookie_path() { $scr = $_SERVER['SCRIPT_NAME']; } - return substr($scr,0,strrpos( $scr,'/')); + $scr = substr($scr,0,strrpos( $scr,'/')); + // add a trailing '/' if needed + return ($scr{strlen($scr)-1} == '/') ? $scr : $scr . '/'; } /** |