]> git.mxchange.org Git - mailer.git/blobdiff - inc/mysql-manager.php
Fixes for last activity in mailid.php
[mailer.git] / inc / mysql-manager.php
index e379a695a50ff1fa0d5c41a3f935a62627aa26d0..c57e681367f8fcefab3a6556f2595f693df13b7c 100644 (file)
@@ -677,7 +677,7 @@ function fetchUserData ($userid, $column='userid') {
                        // Is it not zero?
                        if ($GLOBALS['user_data'][getCurrentUserId()]['last_failure_raw'] != '0000-00-00 00:00:00') {
                                // Seperate data/time
-                               $array = explode(' ', $GLOBALS['user_data'][getCurrentUserId()]['last_failure']);
+                               $array = explode(' ', $GLOBALS['user_data'][getCurrentUserId()]['last_failure_raw']);
 
                                // Seperate data and time again
                                $array['date'] = explode('-', $array[0]);
@@ -2223,5 +2223,17 @@ function createNewTask ($subject, $notes, $taskType, $userid = 0, $adminId = 0,
                array($adminId, $userid, $taskType, $subject, smartAddSlashes($notes)), __FUNCTION__, __LINE__, true, $strip);
 }
 
+// Updates last module / online time
+// @TODO Fix inconsistency between last_module and getWhat()
+function updateLastActivity($userid) {
+       // Run the update query
+       SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `last_module`='%s', `last_online`=UNIX_TIMESTAMP(), `REMOTE_ADDR`='%s' WHERE `userid`=%s LIMIT 1",
+               array(
+                       getWhat(),
+                       detectRemoteAddr(),
+                       bigintval($userid)
+               ), __FUNCTION__, __LINE__);
+}
+
 // [EOF]
 ?>