Do not create URLs like index.php?&.

This commit is contained in:
Michal Čihař 2005-11-25 09:12:13 +00:00
parent 3a1d75cc2e
commit 562c710eed
2 changed files with 34 additions and 5 deletions

View File

@ -17,6 +17,7 @@ $Source$
* */.cvsignore: Ignore custom headers and temporary files from Vim.
* libraries/footer.inc.php, lang/*: Better message for new window, thanks
to Sebastian and Marc.
* libraries/auth/cookie.auth.lib.php: Do not create URLs like index.php?&.
2005-11-24 Marc Delisle <lem9@users.sourceforge.net>
* js/querywindow.js: bug #1365503, "do not overwrite this query"

View File

@ -467,17 +467,45 @@ function PMA_auth_set_user()
$GLOBALS['SERVER_SOFTWARE'] = $_SERVER['SERVER_SOFTWARE'];
}
} // end if
$redirect_url = $cfg['PmaAbsoluteUri'] . 'index.php?'
. PMA_generate_common_url(isset($GLOBALS['db']) ? $GLOBALS['db'] : '',
isset($GLOBALS['table']) ? $GLOBALS['table'] : '', '&')
. (!empty($GLOBALS['target']) ? '&target=' . urlencode($GLOBALS['target']) : '')
. '&' . SID;
// URL where to go:
$redirect_url = $cfg['PmaAbsoluteUri'] . 'index.php';
$separator = '?';
// any parameters to pass?
$params = PMA_generate_common_url(isset($GLOBALS['db']) ? $GLOBALS['db'] : '',
isset($GLOBALS['table']) ? $GLOBALS['table'] : '', '&');
if (!empty($params)) {
$redirect_url .= $separator . $params;
$separator = '&';
}
unset($params);
// any target to pass?
if (!empty($GLOBALS['target'])) {
$redirect_url .= $separator . 'target=' . urlencode($GLOBALS['target']).
$separator = '&';
}
// any seesion id to pass?
$sid = '' . SID;
if (!empty($sid)) {
$redirect_url .= $separator . $sid;
$separator = '&';
}
unset($sid);
// cleanup
unset($separtor);
// And finally redirect
if (!empty($GLOBALS['SERVER_SOFTWARE']) && $GLOBALS['SERVER_SOFTWARE'] == 'Microsoft-IIS/5.0') {
header('Refresh: 0; url=' . $redirect_url);
}
else {
header('Location: ' . $redirect_url);
}
exit();
} // end if