diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 81ef44add9..38233139c6 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -699,7 +699,7 @@ function redirect($url) $server_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['server_name'])); $script_name = preg_replace('/^\/?(.*?)\/?$/', '/\1', trim($board_config['script_path'])); $server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) . '/' : '/'; - $url = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($url)); + $url = preg_replace('/^\/?(.*?\/)?$/', '\1', trim($url)); // If redirects don't work for you, first make sure you've entered your server (domain) name, // script path, protocol (insecure (http://) or secure (https://) cookie) and port @@ -712,6 +712,7 @@ function redirect($url) { header('HTTP/1.0 302 Redirect'); } + header('Location: ' . $server_protocol . $server_name . $script_name . $server_port . $url); exit; } diff --git a/phpBB/includes/sessions.php b/phpBB/includes/sessions.php index 4d91484028..2db18c751d 100644 --- a/phpBB/includes/sessions.php +++ b/phpBB/includes/sessions.php @@ -182,7 +182,7 @@ function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_a setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure); setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure); - $SID = ($sessionmethod == SESSION_METHOD_GET || defined('IN_ADMIN')) ? 'sid=' . $session_id : ''; + $SID = 'sid=' . $session_id; return $userdata; } @@ -370,12 +370,12 @@ function append_sid($url, $non_html_amp = false) { global $SID; - if ( !empty($SID) && !eregi('sid=', $url) ) + if ( !empty($SID) && !preg_match('#sid=#', $url) ) { $url .= ( ( strpos($url, '?') != false ) ? ( ( $non_html_amp ) ? '&' : '&' ) : '?' ) . $SID; } - return($url); + return $url; } ?> \ No newline at end of file