]> wagnertech.de Git - timetracker.git/commitdiff
Added last access handling.
authorNik Okuntseff <support@anuko.com>
Sun, 18 Mar 2018 18:13:51 +0000 (18:13 +0000)
committerNik Okuntseff <support@anuko.com>
Sun, 18 Mar 2018 18:13:51 +0000 (18:13 +0000)
WEB-INF/lib/common.lib.php
WEB-INF/lib/ttUserHelper.class.php
WEB-INF/templates/footer.tpl

index 69c38b731e63a867d6530c7d99faf96f1bd5f1e8..3dce388f5193706cbca402054db09678fb2f694b 100644 (file)
@@ -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;
 }
index bd4570a54a09747579451586507479934c748308..9513a721a4adbe21923497a19079a96c3328d0e5 100644 (file)
@@ -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);
+  }
 }
index 7bfc132bf56ac3ae8a93b8f070c55530df8bfc93..3c74775ce62f5eaeb42b40e67c0ebcd8d12390dd 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.17.54.4102 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.17.55.4103 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>