diff options
author | rub <rub@piwigo.org> | 2007-05-11 20:09:21 +0000 |
---|---|---|
committer | rub <rub@piwigo.org> | 2007-05-11 20:09:21 +0000 |
commit | 2f9084b5e9691b8b1b2c5fa30d6ce96272bf1ac4 (patch) | |
tree | 2a99576b1786b6ddab0c10357ed7c354c8fe80b5 /include/functions_session.inc.php | |
parent | 1e8220d083ffebf0b109050fb258235723234dc1 (diff) |
Issue 0000619: bad result of cookie_path() function
After discussion with Radu of an other case, PATH_INFO is re-introduce with news conditions.
Apply modifications from BSF (2006) ;-)
git-svn-id: http://piwigo.org/svn/branches/branch-1_7@2007 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_session.inc.php')
-rw-r--r-- | include/functions_session.inc.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/functions_session.inc.php b/include/functions_session.inc.php index a4a0bd8a1..ad1822f30 100644 --- a/include/functions_session.inc.php +++ b/include/functions_session.inc.php @@ -89,7 +89,21 @@ function cookie_path() { // 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. - $scr = $_SERVER['REDIRECT_URL']; + if + ( + isset($_SERVER['PATH_INFO']) and !empty($_SERVER['PATH_INFO']) and + ($_SERVER['REDIRECT_URL'] !== $_SERVER['PATH_INFO']) and + (substr($_SERVER['REDIRECT_URL'],-strlen($_SERVER['PATH_INFO'])) + == $_SERVER['PATH_INFO']) + ) + { + $scr = substr($_SERVER['REDIRECT_URL'], 0, + strlen($_SERVER['REDIRECT_URL'])-strlen($_SERVER['PATH_INFO'])); + } + else + { + $scr = $_SERVER['REDIRECT_URL']; + } } else { |