I am trying to solve the timezone problem. How about this approach:
PHP Code:
$enddate = time();
$localdate = $enddate-(($timeoffset-$bbuserinfo['timezoneoffset'])*3600);
$timepassed = $localdate - ($localdate - ($localdate % 86400));
$startdate = $enddate - $timepassed;
$todayusers=$DB_site->query("SELECT userid, username, usergroupid, lastactivity, invisible FROM user
WHERE lastactivity BETWEEN $startdate AND $enddate
ORDER BY username");
The idea:
1) Get the local time adjusted for the TZ == $localdate
2) Calculate the time that has passed between now locally ($localdate) and midnight locally (($localdate - ($localdate % 86400)) == $timepassed
3) Subtract the time that has passed locally since midnight from the servers time now == $startdate
4) Query user activity in the time between server time now ($enddate) and the time when it was midnight locally.
I hope that I expressed myself somewhat clearly. I am an absolute PHP beginner, so I am not sure if what I did above is correct. However, the idea per se should be right.
Would be glad for comments and possible corrections.
Alexander