| GLPI | SCCM |
NESSUS | SCOM | Zabbix | SentinelOne | $okText | Missing | "; } try { $diff = date_diff(date_create($lastUpdate), date_create()); $days = (int) $diff->format("%R%a"); if ($days > $daysThreshold) { return "$okText | $lastUpdate ($days days) | "; } else { return "$okText | $lastUpdate | "; } } catch (Exception) { return "Invalid Date | $lastUpdate | "; } } if ($status !== '') { return "$status | "; } return " | Missing | "; } // --- PART 3: DATA PROCESSING & DISPLAY --- $counters = [ 'total' => 0, 'ok' => 0, 'nOS' => 0, 'nAD' => 0, 'nSCCM' => 0, 'nGLPI' => 0, 'nFI' => 0, 'nNESSUS' => 0, 'nNBU' => 0, 'nDPM' => 0, 'nS1' => 0, 'nzabbix' => 0, 'nSCOM' => 0 ]; $maxS1Win = "0"; $maxS1Lin = "0"; $dataRows = []; while ($row = $result->fetch_assoc()) { $dataRows[] = $row; $currentV = $row['S1'] ?? ''; $os = $row['OS'] ?? ''; if (str_contains($currentV, '.')) { if (stripos($os, 'Windows') !== false) { if (version_compare($currentV, $maxS1Win, '>')) { $maxS1Win = $currentV; } } else { if (version_compare($currentV, $maxS1Lin, '>')) { $maxS1Lin = $currentV; } } } } foreach ($dataRows as $row) { // KPI Calculation $counters['total']++; $isCompliant = isset($row['AD'], $row['GLPI'], $row['SCCM'], $row['EPO']) && (isset($row['NBU']) || isset($row['DPM'])) && isset($row['SCOM']); if ($isCompliant) { $counters['ok']++; } if (!empty($row['OS']) && !preg_match('(XP|2003|2000|2008|Windows 7|2012)', $row['OS'])) { $counters['nOS']++; } if (!isset($row['AD'])) $counters['nAD']++; if (!isset($row['SCCM'])) $counters['nSCCM']++; if (!isset($row['GLPI'])) $counters['nGLPI']++; if (!isset($row['EPO'])) $counters['nNESSUS']++; if (!isset($row['NBU']) && !isset($row['DPM'])) $counters['nNBU']++; if (!isset($row['SCOM'])) $counters['nSCOM']++; if (!isset($row['zabbix'])) $counters['nzabbix']++; if (!isset($row['S1'])) $counters['nS1']++; // Row Rendering $serverName = htmlspecialchars($row['Server'] ?? '', ENT_QUOTES, 'UTF-8'); $serverUrl = urlencode($row['Server'] ?? ''); if ($isCompliant) { $serverCell = " | $serverName | "; } else { $serverCell = "$serverName | "; } $osCell = ""; if (!empty($row['OS'])) { $os = htmlspecialchars($row['OS']); $osCell = preg_match('(XP|2003|2000|2008|Windows 7|2012)', $row['OS']) ? " | $os | " : "$os | "; } echo "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| " . htmlspecialchars($row['crit'] ?? '') . " | "; echo renderStatusCellWithDate($row['AD'], $row['ADlu'], 45); echo renderStatusCellWithDate($row['GLPI'], $row['GLPIlu'], 7); echo renderStatusCellWithDate($row['SCCM'], $row['SCCMlu'], 7); // NESSUS if (str_contains($row['EPO'] ?? '', '.')) { echo "".htmlspecialchars($row['EPO'])." | "; } elseif (isset($row['EPO']) && !in_array($row['EPO'], ['Y', 'N'])) { echo "".htmlspecialchars($row['EPO'])." | "; } else { echo "Missing | "; } // BACKUP if (($row['NBU'] ?? '') === 'Y') { echo renderStatusCellWithDate($row['NBU'], $row['NBUlu'], 30, 'OK (NBU)'); } elseif (($row['DPM'] ?? '') === 'Y') { echo renderStatusCellWithDate($row['DPM'], $row['DPMlu'], 30, 'OK (DPM)'); } else { echo renderStatusCellWithDate($row['NBU'] ?? $row['DPM'] ?? null, null, 30); } // SCOM if (($row['SCOM'] ?? '') === 'Y') { echo "OK | "; } elseif (isset($row['SCOM'])) { echo "".htmlspecialchars($row['SCOM'])." | "; } else { echo "Missing | "; } // Zabbix $zabbixStatus = $row['zabbix'] ?? ''; if ($zabbixStatus === 'Y' || str_contains($zabbixStatus, '.')) { echo "".htmlspecialchars(str_replace('Y', 'OK', $zabbixStatus))." | "; } elseif (isset($row['zabbix'])) { echo "".htmlspecialchars($zabbixStatus)." | "; } else { echo "Missing | "; } // S1 (Comparison) $s1Status = $row['S1'] ?? ''; $osRaw = $row['OS'] ?? ''; $targetMax = (stripos($osRaw, 'Windows') !== false) ? $maxS1Win : $maxS1Lin; if (!empty($s1Status) && $s1Status === $targetMax && $targetMax !== "0") { echo "" . htmlspecialchars($s1Status) . " | "; } elseif (str_contains($s1Status, '.')) { echo "" . htmlspecialchars($s1Status) . " | "; } else { echo renderStatusCellWithDate($s1Status, $row['S1lu'] ?? null, 7, ($s1Status === 'Y' ? 'OK' : $s1Status)); } echo "