Move $_SESSION['current'] manipulation into user class. Add user::logout() to keep user::login() and logout() symmetrical
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user