diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/util.php b/lib/util.php index 87a6a42c5..5fec73552 100644 --- a/lib/util.php +++ b/lib/util.php @@ -614,8 +614,14 @@ function common_rememberme($user=NULL) { } $rm = new Remember_me(); + $rm->code = common_good_rand(16); $rm->user_id = $user->id; + + # Wrap the insert in some good ol' fashioned transaction code + + $rm->query('BEGIN'); + $result = $rm->insert(); if (!$result) { @@ -624,6 +630,8 @@ function common_rememberme($user=NULL) { return false; } + $rm->query('COMMIT'); + common_debug('Inserted rememberme record (' . $rm->code . ', ' . $rm->user_id . '); result = ' . $result . '.', __FILE__); $cookieval = $rm->user_id . ':' . $rm->code; |