]> git.mxchange.org Git - mailer.git/commitdiff
Fixes for last activity in mailid.php
authorRoland Häder <roland@mxchange.org>
Thu, 5 Nov 2009 14:44:42 +0000 (14:44 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 5 Nov 2009 14:44:42 +0000 (14:44 +0000)
inc/filters.php
inc/mysql-manager.php
mailid.php

index 4426a95aa66ce611a60ba19814e5edac3a55e83d..56d82c0f92669b38beb84bdb2296a88faf103638 100644 (file)
@@ -307,12 +307,7 @@ function FILTER_UPDATE_LOGIN_DATA () {
                } // END - if
 
                // Update last module / online time
-               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(),
-                               getMemberId()
-                       ), __FUNCTION__, __LINE__);
+               updateLastActivity(getMemberId());
        }  else {
                // Destroy session, we cannot update!
                destroyMemberSession();
index e8faf0c63c5f293b49a59cbdcd44901047425a1f..c57e681367f8fcefab3a6556f2595f693df13b7c 100644 (file)
@@ -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]
 ?>
index 68dfb1cfe185b99d1253754212d7d11c2ea4bd86..26a90bae141d36d122444dd58ec0d6314a1f6cac 100644 (file)
@@ -95,7 +95,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErr
                switch ($ltype) {
                        case 'NORMAL':
                                // Is the stats id valid?
-                               $result = SQL_QUERY_ESC("SELECT pool_id, url, subject FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `id`=%s LIMIT 1",
+                               $result = SQL_QUERY_ESC("SELECT `pool_id`, `url`, `subject` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `id`=%s LIMIT 1",
                                        array($url_mid), __FILE__, __LINE__);
                                break;
 
@@ -127,11 +127,14 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErr
                        if (fetchUserData($url_userid)) {
                                // Status must be CONFIRMED
                                if (getUserData('status') == 'CONFIRMED') {
+                                       // Update last activity
+                                       updateLastActivity($url_userid);
+
                                        // User has confirmed his account so we can procede...
                                        // @TODO Rewrite this to a filter
                                        switch ($ltype) {
                                                case 'NORMAL':
-                                                       $result = SQL_QUERY_ESC("SELECT payment_id FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s LIMIT 1",
+                                                       $result = SQL_QUERY_ESC("SELECT `payment_id` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s LIMIT 1",
                                                                array(bigintval($pool)), __FILE__, __LINE__);
                                                        if (SQL_NUMROWS($result) == 1) {
                                                                list($pay) = SQL_FETCHROW($result);
@@ -145,7 +148,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErr
                                                        break;
 
                                                case 'BONUS':
-                                                       $result = SQL_QUERY_ESC("SELECT points, time FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
+                                                       $result = SQL_QUERY_ESC("SELECT `points`, `time` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
                                                                array($url_bid), __FILE__, __LINE__);
                                                        if (SQL_NUMROWS($result) == 1) {
                                                                list($points, $time) = SQL_FETCHROW($result);