diff --git a/weave_storage.php b/weave_storage.php index 87987f6..c3303ee 100644 --- a/weave_storage.php +++ b/weave_storage.php @@ -731,6 +731,25 @@ class WeaveStorage } return 1; } + + function store_user_login($username) + { + try + { + $update_statement = "update users set login = :logintime where username = :username"; + + $sth = $this->_dbh->prepare($update_statement); + $sth->bindParam(':username', $username); + $sth->bindParam(':logintime', time()); + $sth->execute(); + } + catch( PDOException $exception ) + { + log_error("update login:" . $exception->getMessage()); + return 0; + } + return 1; + } function create_user($username, $password) { diff --git a/weave_utils.php b/weave_utils.php index 5f5045c..586f38f 100644 --- a/weave_utils.php +++ b/weave_utils.php @@ -252,7 +252,8 @@ log_error($e->getMessage(), $e->getCode()); report_problem($e->getMessage(), $e->getCode()); } - + // Login success - record login time + $db->store_user_login($auth_user); return true; }