= 0) return -1; if ($b_days < 0 && $a_days >= 0) return 1; // 4️⃣ Ordina per giorni crescenti (meno giorni prima) return $a_days <=> $b_days; }); foreach($webcheck_json as $check_element){ //VARIABLES $host=$check_element['host']; $domain=$check_element['domain']; $path=$check_element['path']; $checkword_ok=$check_element['wordcheck_ok']; $sslcheck_ok=$check_element['sslcheck_ok']; $wordtocheck=$check_element['wordtocheck']; $ssl_released=$check_element['ssl-released']; $ssl_expiry=$check_element['ssl-expiry']; $ssl_company=$check_element['ssl-company']; $http_error=$check_element['content_http_code']; $content_error=$check_element['content_error']; $ssl_error=$check_element['ssl_error']; $expirying_days = ssl_days_left($ssl_expiry); $expiry_col = get_expiry_style($expirying_days); $status_class = get_status_class($sslcheck_ok, $checkword_ok, $ssl_expiry); $col_red = "#ff4747"; $col_orange = "#ff830f"; $col_yellow = "#ffd70f"; $col_green = "#42c500"; if($expirying_days < 0){ $expiry_col='style="font-weight:bold; color:' . $col_red . ';"'; }elseif($expirying_days <= SSL_CRITICAL_DAYS ){ $expiry_col='style="font-weight:bold; color:' . $col_orange . ';"'; }elseif($expirying_days <= SSL_WARNING_DAYS){ $expiry_col='style="font-weight:bold; color:' . $col_yellow . ';"'; }else{ $expiry_col='style="font-weight:bold; color:' . $col_green . ';"'; } if ($path == ""){ $path = "/"; } ?>
HOST:
DOMAIN:
>CONTENT:
>SSL:
WORD TO CHECK:
SSL RELEASED:
SSL EXPIRY: >
SSL DAYS LEFT: >
SSL COMPANY:
PATH:
ERROR CODE:
ERROR CODE:
CONTENT ERROR:
SSL ERROR:
$element){ // Total domain to check $totaldomain ++; // Total fine domain if ($element['sslcheck_ok'] == 1 && $element['wordcheck_ok'] == 1){ $totalok ++; } // Total SSL Problem if ($element['sslcheck_ok'] !== 1){ $totalssl_p ++; } // Total Word-check Problem if ($element['wordcheck_ok'] !== 1){ $totalcheck_p ++; } } switch($type){ case "total": echo $totaldomain; break; case "ok": echo $totalok; break; case "ssl": echo $totalssl_p; break; case "word": echo $totalcheck_p; break; } } function ssl_days_left($expiry_date) { if (empty($expiry_date)) return null; $expiry = DateTime::createFromFormat('d/m/Y', $expiry_date); if (!$expiry) return null; $now = new DateTime(); $interval = $now->diff($expiry); $days = (int)$interval->format('%r%a'); // giorni con segno return $days; } function get_expiry_style($days){ $col_red = "#ff4747"; $col_orange = "#ff830f"; $col_yellow = "#ffd70f"; $col_green = "#42c500"; if ($days === null) return ""; if ($days < 0) { return "style='font-weight:bold;color:$col_red;'"; } elseif ($days <= SSL_CRITICAL_DAYS) { return "style='font-weight:bold;color:$col_orange;'"; } elseif ($days <= SSL_WARNING_DAYS) { return "style='font-weight:bold;color:$col_yellow;'"; } return "style='font-weight:bold;color:$col_green;'"; } ?>