From f78e9d03b7dbcc279029c52aece638a5bc5aaaad Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Wed, 18 Dec 2002 01:06:19 +0000 Subject: [PATCH] Redirect and SID updates ... add SID by default to all new sessions as they are created git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@3203 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 3 ++- phpBB/includes/sessions.php | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) 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