I am trying to work out if users have had activity in the past hour. The following is my code, but it always returns yes, no matter what:
$houraway = (int)mktime() + (60 * 60);
$now = mktime();
while($user = mysql_fetch_array($qusers)) {
echo $user['Name']." - ";
$datetime = explode(" ", $user['Custom6']);
$date = $datetime[0];
$date = explode("-", $date);
$time = $datetime[1];
$time = explode(":", $time);
$hr = $time[0];
$min = $time[1];
$sec = $time[2];
$y = $date[0];
$m = $date[1];
$d = $date[2];
$lastloginmk = (int)mktime($hr, $min, $sec, $m, $d, $y);
echo " - ".$lastloginmk;
if($lastloginmk <= $houraway) { echo "yes"; } else { echo "no"; }
echo "<br />";
}
last activity time is stored in the database like this:
2009-09-22 13:32:28
Thanks in advance!
Ryan