aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/login.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2001-10-14 18:22:32 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2001-10-14 18:22:32 +0000
commit715a51c548f36ab2dca1fd61723f2f0b45e67a18 (patch)
treede089b57a0236d392c4dde081107a8a0d0dd6856 /phpBB/login.php
parente4b9702ebc17ce0e3afb33afdd0e481d87e305ad (diff)
downloadforums-715a51c548f36ab2dca1fd61723f2f0b45e67a18.tar
forums-715a51c548f36ab2dca1fd61723f2f0b45e67a18.tar.gz
forums-715a51c548f36ab2dca1fd61723f2f0b45e67a18.tar.bz2
forums-715a51c548f36ab2dca1fd61723f2f0b45e67a18.tar.xz
forums-715a51c548f36ab2dca1fd61723f2f0b45e67a18.zip
Various changes to location redirection ... please note the format and name changes
git-svn-id: file:///svn/phpbb/trunk@1190 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/login.php')
-rw-r--r--phpBB/login.php57
1 files changed, 32 insertions, 25 deletions
diff --git a/phpBB/login.php b/phpBB/login.php
index 926bf69776..d725a4ad4b 100644
--- a/phpBB/login.php
+++ b/phpBB/login.php
@@ -50,24 +50,24 @@ if( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) || isset($
}
$rowresult = $db->sql_fetchrow($result);
- if(count($rowresult))
+
+ if( count($rowresult) )
{
- if((md5($password) == $rowresult['user_password']) && $rowresult['user_active'] != 0)
+ if( (md5($password) == $rowresult['user_password']) && $rowresult['user_active'] != 0 )
{
- $autologin = (isset($HTTP_POST_VARS['autologin'])) ? TRUE : FALSE;
+ $autologin = (isset($HTTP_POST_VARS['autologin'])) ? TRUE : 0;
$session_id = session_begin($rowresult['user_id'], $user_ip, PAGE_INDEX, $session_length, TRUE, $autologin);
- if($session_id)
+ if( $session_id )
{
- if( !empty($HTTP_POST_VARS['forward_page']) )
+ if( !empty($HTTP_POST_VARS['redirect']) )
{
-// echo $HTTP_POST_VARS['forward_page'];
- header("Location: " . $HTTP_POST_VARS['forward_page']);
+ header("Location: " . append_sid($HTTP_POST_VARS['redirect'], true));
}
else
{
- header("Location: " . append_sid("index.$phpEx"));
+ header("Location: " . append_sid("index.$phpEx", true));
}
}
else
@@ -91,24 +91,25 @@ if( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) || isset($
{
session_end($userdata['session_id'], $userdata['user_id']);
}
- if( !empty($HTTP_POST_VARS['forward_page']) )
+
+ if( !empty($HTTP_POST_VARS['redirect']) )
{
- header("Location: " . append_sid($HTTP_POST_VARS['forward_page']));
+ header("Location: " . append_sid($HTTP_POST_VARS['redirect'], true));
}
else
{
- header("Location: " . append_sid("index.$phpEx"));
+ header("Location: " . append_sid("index.$phpEx", true));
}
}
else
{
- if( !empty($HTTP_POST_VARS['forward_page']) )
+ if( !empty($HTTP_POST_VARS['redirect']) )
{
- header(append_sid("Location: ".$HTTP_POST_VARS['forward_page']));
+ header("Location: " . append_sid($HTTP_POST_VARS['redirect'], true));
}
else
{
- header("Location: " . append_sid("index.$phpEx"));
+ header("Location: " . append_sid("index.$phpEx", true));
}
}
}
@@ -120,18 +121,17 @@ else
//
if(!$userdata['session_logged_in'])
{
- $page_title = "Log In";
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
"body" => "login_body.tpl")
);
- if( isset($HTTP_POST_VARS['forward_page']) || isset($HTTP_GET_VARS['forward_page']) )
+ if( isset($HTTP_POST_VARS['redirect']) || isset($HTTP_GET_VARS['redirect']) )
{
- echo $forward_to = $HTTP_SERVER_VARS['QUERY_STRING'];
+ $forward_to = $HTTP_SERVER_VARS['QUERY_STRING'];
- if( preg_match("/^forward_page=(.*)(&sid=[0-9]*)$|^forward_page=(.*)$/si", $forward_to, $forward_matches) )
+ if( preg_match("/^redirect=(.*)$/si", $forward_to, $forward_matches) )
{
$forward_to = ($forward_matches[3]) ? $forward_matches[3] : $forward_matches[1];
@@ -139,16 +139,21 @@ else
if(count($forward_match) > 1)
{
- $forward_page = $forward_match[0] . "?";
+ $forward_page = "";
for($i = 1; $i < count($forward_match); $i++)
{
- $forward_page .= $forward_match[$i];
- if($i < count($forward_match) - 1)
+ if( !ereg("sid=", $forward_match[$i]) )
{
- $forward_page .= "&";
+ if( $forward_page != "" )
+ {
+ $forward_page .= "&";
+ }
+ $forward_page .= $forward_match[$i];
}
}
+
+ $forward_page = $forward_match[0] . "?" . $forward_page;
}
else
{
@@ -163,14 +168,16 @@ else
$username = ($userdata['user_id'] != ANONYMOUS) ? $userdata['username'] : "";
+ $s_hidden_fields = '<input type="hidden" name="redirect" value="' . $forward_page . '" />';
+
$template->assign_vars(array(
- "FORWARD_PAGE" => $forward_page,
"USERNAME" => $username,
"L_SEND_PASSWORD" => $lang['Forgotten_password'],
- "U_SEND_PASSWORD" => append_sid("profile.$phpEx?mode=sendpassword")
- )
+ "U_SEND_PASSWORD" => append_sid("profile.$phpEx?mode=sendpassword"),
+
+ "S_HIDDEN_FIELDS" => $s_hidden_fields)
);
$template->pparse("body");