Workshop Computers
Online Staging Units ()
No staging units currently online
0) { $imageTimestamp = $ts; $imageAge = time() - $ts; $imageTimeFormatted = date('g:ia', $ts); } } // Check timestamp file age (how recently the image file was written to disk) $tsFileAge = null; if (file_exists($tsFile)) { $tsFileAge = time() - filemtime($tsFile); } // Check if camera is uploading images despite not pinging $isUploading = false; if (!$isPinging && $tsFileAge !== null) { $isUploading = ($tsFileAge < $uploadThreshold); } // Check ping.txt age for recently online detection $pingFileAge = null; $pingFile = "/home/subdomains/livetimelapse/public_html/monitoring/logs/tlc_master{$i}/ping.txt"; if (file_exists($pingFile)) { $pingFileAge = time() - filemtime($pingFile); } if ($isPinging || $isUploading) { $onlineCount++; } else { $offlineCount++; } // Determine status class and label if ($isPinging) { $statusClass = 'status-online'; $pingStatus = 'PINGING'; $overlayClass = 'pinging'; } elseif ($isUploading) { $statusClass = 'status-uploading'; $pingStatus = 'UPLOADING'; $overlayClass = 'uploading'; } else { $statusClass = 'status-offline'; $pingStatus = 'NOT PINGING'; $overlayClass = 'not-pinging'; } // Get shortened VPN IP (remove 192.168. prefix) $vpnIPShort = $vpnIP ? str_replace("192.168.", "", trim($vpnIP)) : 'N/A'; // Determine label $label = ''; if ($i == 1) $label = 'Brisbane Workshop'; if ($i == 2) $label = 'Sydney Workshop'; // Determine if recently online (pinged or uploaded within 24h but not currently online) $isRecentlyOnline = false; if (!$isPinging && !$isUploading) { if (($pingFileAge !== null && $pingFileAge < $recentThreshold) || ($tsFileAge !== null && $tsFileAge < $recentThreshold)) { $isRecentlyOnline = true; } } $camera = [ 'id' => $i, 'vpnIP' => trim($vpnIP), 'vpnIPShort' => $vpnIPShort, 'isPinging' => $isPinging, 'isUploading' => $isUploading, 'isRecentlyOnline' => $isRecentlyOnline, 'pingStatus' => $pingStatus, 'statusClass' => $statusClass, 'overlayClass' => $overlayClass, 'vpnAge' => $vpnAge, 'imageAge' => $imageAge, 'imageTimeFormatted' => $imageTimeFormatted, 'label' => $label, 'imageUrl' => "https://livetimelapse.com.au/webcams/tlc_master{$i}/980x655.jpg?nocache={$cacheBuster}", 'detailUrl' => "camera-detail.html?id={$i}", 'resetUrl' => "reset-master.php?cameraNumber={$i}" ]; // Separate into 4 groups if ($i <= 2) { $workshops[] = $camera; } elseif ($isPinging || $isUploading) { $onlineStagingUnits[] = $camera; } elseif ($isRecentlyOnline) { $recentlyOnlineUnits[] = $camera; } else { $offlineStagingUnits[] = $camera; } } $userTheme = load_user_theme($_SESSION['auth_user'] ?? ''); ?>
No staging units currently online