PHP - Comparing date, checking if within last hour
if(time() - strtotime($unit['last_accessed']) < 3601){
or
if(time() - strtotime($unit['last_accessed']) > 3599){
time() and strtotime() both use the same time base in seconds
if $unit['last_accessed'] is already an integer time variable then do not use strtotime().
First of all, you're using date function in a wrong way. From PHP's manual:
date ( string $format [, int $timestamp = time() ] )
You must provide as first argument the $format string and the $timestamp as the second. You can check if the time is whitin the last hour without transform the Unix Timestamp to a another timestamp string.
$last_hour = time() - 60*60; //last hour timestamp
if($unit['last_accessed'] >= $last_hour){
$connect = "<i class='fa fa-circle 2x' style='color:#2ECC71;'></i>";
}else{
$connect = '';
}
As you can see, i didnt made any transformation to the timestamp, as i'm not using the timestring in anywhere. You should learn a little more about operations with unix timestamp's or about php time functions.
References: http://php.net/manual/en/function.date.php