// Updates last module / online time
// @TODO Fix inconsistency between last_module and getWhat()
function updateLastActivity($userid) {
- // Run the update query
- SQL_QUERY_ESC("UPDATE
+ // Is 'what' set?
+ if (isWhatSet()) {
+ // Run the update query
+ SQL_QUERY_ESC("UPDATE
`{?_MYSQL_PREFIX?}_user_data`
SET
`last_module`='%s',
detectRemoteAddr(),
bigintval($userid)
), __FUNCTION__, __LINE__);
+ } else {
+ // No what set, needs to be ignored (last_module is last_what)
+ // @TODO Rename last_module to last_what to make it more clear
+ SQL_QUERY_ESC("UPDATE
+ `{?_MYSQL_PREFIX?}_user_data`
+SET
+ `last_online`=UNIX_TIMESTAMP(),
+ `REMOTE_ADDR`='%s'
+WHERE
+ `userid`=%s
+LIMIT 1",
+ array(
+ detectRemoteAddr(),
+ bigintval($userid)
+ ), __FUNCTION__, __LINE__);
+ }
}
// [EOF]