From: Nik Okuntseff Date: Sun, 18 Mar 2018 18:13:51 +0000 (+0000) Subject: Added last access handling. X-Git-Tag: timetracker_1.19-1~1009 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/commitdiff_plain/ecf7d911c95935f8cfb2403f645cd12f93d8c3f5?ds=inline;hp=9494c6e4f474c5687d388b32c167f31cbe0aeb62 Added last access handling. --- diff --git a/WEB-INF/lib/common.lib.php b/WEB-INF/lib/common.lib.php index 69c38b73..3dce388f 100644 --- a/WEB-INF/lib/common.lib.php +++ b/WEB-INF/lib/common.lib.php @@ -340,8 +340,10 @@ function ttAccessAllowed($required_right) } // Check if user has the right. - if (in_array($required_right, $user->rights)) + if (in_array($required_right, $user->rights)) { + ttUserHelper::updateLastAccess(); return true; + } return false; } diff --git a/WEB-INF/lib/ttUserHelper.class.php b/WEB-INF/lib/ttUserHelper.class.php index bd4570a5..9513a721 100644 --- a/WEB-INF/lib/ttUserHelper.class.php +++ b/WEB-INF/lib/ttUserHelper.class.php @@ -474,4 +474,13 @@ class ttUserHelper { } return true; } + + // updateLastAccess - updates last access info for user in db. + static function updateLastAccess() { + global $user; + $mdb2 = getConnection(); + $accessed_ip = $mdb2->quote($_SERVER['REMOTE_ADDR']); + $sql = "update tt_users set accessed = now(), accessed_ip = $accessed_ip where id = $user->id"; + $mdb2->exec($sql); + } } diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 7bfc132b..3c74775c 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.17.54.4102 | Copyright © Anuko | +  Anuko Time Tracker 1.17.55.4103 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve}