} // 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();
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]
?>
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;
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);
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);