force session again and correctly get ID

darcs-hash:20080624031746-34904-3719874e1e0afa201e5c81e267531f0768ddacd9.gz
This commit is contained in:
Evan Prodromou 2008-06-23 23:17:46 -04:00
parent ae2603ec13
commit 8cc7e4723d

View File

@ -457,7 +457,7 @@ function common_rememberme() {
} }
$rm = new Remember_me(); $rm = new Remember_me();
$rm->code = common_good_rand(16); $rm->code = common_good_rand(16);
$rm->user_id = $user->id(); $rm->user_id = $user->id;
if (!$rm->insert()) { if (!$rm->insert()) {
common_log_db_error($rm, 'INSERT', __FILE__); common_log_db_error($rm, 'INSERT', __FILE__);
return false; return false;
@ -506,13 +506,12 @@ function common_forgetme() {
# who is the current user? # who is the current user?
function common_current_user() { function common_current_user() {
if (common_have_session()) { common_ensure_session();
$id = $_SESSION['userid']; $id = $_SESSION['userid'];
if ($id) { if ($id) {
# note: this should cache # note: this should cache
$user = User::staticGet($id); $user = User::staticGet($id);
return $user; return $user;
}
} }
# that didn't work; try to remember # that didn't work; try to remember