1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-14 20:50:30 +01:00

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
function redirect($location)
function redirect($url)
{
global $db;
global $db, $config;
if (isset($db))
{
$db->sql_close();
}
$header_location = (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) ? 'Refresh: 0; URL=' : 'Location: ';
header($header_location . $location);
$protocol = ($config['cookie_secure']) ? 'https://' : 'http://';
$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;
}