From: Roland Häder Date: Thu, 5 Nov 2009 14:44:42 +0000 (+0000) Subject: Fixes for last activity in mailid.php X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=48329d370d84b30c0107a55c95630d4528e6bdf5;p=mailer.git Fixes for last activity in mailid.php --- diff --git a/inc/filters.php b/inc/filters.php index 4426a95aa6..56d82c0f92 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -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(); diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index e8faf0c63c..c57e681367 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -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] ?> diff --git a/mailid.php b/mailid.php index 68dfb1cfe1..26a90bae14 100644 --- a/mailid.php +++ b/mailid.php @@ -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);