Move $_SESSION['current'] manipulation into user class. Add user::logout() to keep user::login() and logout() symmetrical

This commit is contained in:
Chris Morgan
2006-07-06 03:37:49 +00:00
committed by WineHQ
parent 1366e5fba1
commit 2b0d5716bb
2 changed files with 20 additions and 4 deletions

View File

@@ -75,11 +75,24 @@ class User {
// Update timestamp and clear the inactivity flag if it was set
query_parameters("UPDATE user_list SET stamp = ?, inactivity_warned = '?' WHERE userid='?'",
"NOW()", "false", $this->iUserId);
/* set the session variable for the current user to this user object */
$_SESSION['current'] = $this;
return SUCCESS;
}
/* null out the session variable for the current user since we failed to login */
$_SESSION['current'] = "";
return USER_LOGIN_FAILED;
}
function logout()
{
/* null out the session current variable to log us out */
$_SESSION['current'] = "";
}
/*
* Creates a new user.