aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorchrisaga <chrisaga@piwigo.org>2006-07-08 09:27:23 +0000
committerchrisaga <chrisaga@piwigo.org>2006-07-08 09:27:23 +0000
commit63bc9838cd41fd66d359a00c53ef476af303f3b4 (patch)
treee820a3ca61c670007dbf2e4e48514a0ac10aae53 /include
parent876d9e63fc3ff814f84acb6c5f8293c8542dbba4 (diff)
fix bug 458: Cannot log due to broken session cookie (wrong "path")
use $_SERVER['REDIRECT_URL'] if it's set add a trailing '/' git-svn-id: http://piwigo.org/svn/trunk@1442 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r--include/functions_session.inc.php11
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 . '/';
}
/**