Redirect changes

git-svn-id: file:///svn/phpbb/trunk@3161 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-12-02 23:53:21 +00:00
parent afd03ff1b8
commit df3e7ab532

View file

@ -685,17 +685,25 @@ function obtain_word_list(&$orig_word, &$replacement_word)
} }
// Redirects the user to another page then exits the script nicely // Redirects the user to another page then exits the script nicely
function redirect($location) function redirect($url)
{ {
global $db; global $db, $config;
if (isset($db)) if (isset($db))
{ {
$db->sql_close(); $db->sql_close();
} }
$header_location = (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) ? 'Refresh: 0; URL=' : 'Location: '; $protocol = ($config['cookie_secure']) ? 'https://' : 'http://';
header($header_location . $location); $server = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($config['server_name']));
$path = preg_replace('/^\/?(.*?)\/?$/', '/\1', trim($config['script_path']));
$port = ($config['server_port'] <> 80) ? ':' . trim($config['server_port']) . '/' : '/';
if (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')))
{
header('HTTP/1.0 302 Redirect');
}
header('Location: ' . $protocol . $server . $path . $port . $url);
exit; exit;
} }
@ -1001,4 +1009,4 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
} }
} }
?> ?>