aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2007-05-11 20:07:47 +0000
committerrub <rub@piwigo.org>2007-05-11 20:07:47 +0000
commit21a95d9f404e8964f7fc608d30db1b7ed97c0133 (patch)
tree1d236949a61a48eff10df7c5622c0f2d12dcb8fb
parentd9d2a5ad8deb6023100237a1a8f23fdd920ca3f3 (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. git-svn-id: http://piwigo.org/svn/trunk@2006 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--include/functions_cookie.inc.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/functions_cookie.inc.php b/include/functions_cookie.inc.php
index f4b1a7533..4b8f70b1e 100644
--- a/include/functions_cookie.inc.php
+++ b/include/functions_cookie.inc.php
@@ -39,7 +39,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
{