mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
Changed to tie in with session code updates
git-svn-id: file:///svn/phpbb/trunk@119 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
19c5037dd5
commit
c33d7500fb
1 changed files with 51 additions and 22 deletions
|
@ -24,34 +24,63 @@
|
||||||
include('extension.inc');
|
include('extension.inc');
|
||||||
include('common.'.$phpEx);
|
include('common.'.$phpEx);
|
||||||
|
|
||||||
if($submit)
|
if(isset($HTTP_POST_VARS['submit']) || isset($HTTP_GET_VARS['submit']))
|
||||||
{
|
{
|
||||||
$userdata = get_userdata($username, $db);
|
if($HTTP_POST_VARS['submit'] == "Login" && !$userdata['session_logged_in'])
|
||||||
if($userdata["error"])
|
|
||||||
{
|
|
||||||
error_die($db, LOGIN_FAILED);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if(!auth("login", $db))
|
|
||||||
{
|
$username = $HTTP_POST_VARS["username"];
|
||||||
error_die($db, LOGIN_FAILED);
|
$password = $HTTP_POST_VARS["password"];
|
||||||
}
|
$sql = "SELECT *
|
||||||
else
|
FROM ".USERS_TABLE."
|
||||||
{
|
WHERE username = '$username'";
|
||||||
$sessid = new_session($userdata[user_id], $user_ip, $session_cookie_time, $db);
|
$result = $db->sql_query($sql);
|
||||||
set_session_cookie($sessid, $session_cookie_time, $session_cookie, "", "", 0);
|
if(!$result)
|
||||||
header("Location: index.$phpEx");
|
{
|
||||||
|
error_die($db, "Error in obtaining userdata : login");
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowresult = $db->sql_fetchrow($result);
|
||||||
|
if(count($rowresult))
|
||||||
|
{
|
||||||
|
if(md5($password) == $rowresult["user_password"])
|
||||||
|
{
|
||||||
|
$session_id = session_begin($db, $rowresult["user_id"], $user_ip, $session_length, 1, $rowresult["user_password"]);
|
||||||
|
if($session_id)
|
||||||
|
{
|
||||||
|
header("Location: index.$phpEx");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
error_die($db, "Couldn't start session : login");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
error_die($db, LOGIN_FAILED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
error_die($db, LOGIN_FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else if($HTTP_GET_VARS['submit'] == "logout" && $userdata['session_logged_in'])
|
||||||
else if($logout)
|
|
||||||
{
|
|
||||||
if($user_logged_in)
|
|
||||||
{
|
{
|
||||||
end_user_session($userdata["user_id"], $db);
|
if($userdata['session_logged_in'])
|
||||||
|
{
|
||||||
|
session_end($db, $userdata["session_id"], $userdata["user_id"]);
|
||||||
|
}
|
||||||
|
header("Location: index.$phpEx");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
header("Location: index.$phpEx");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
header("Location: index.$phpEx");
|
header("Location: index.$phpEx");
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Add table
Reference in a new issue