Example #1
0
     $ping_text_try = " : {" . $ping_text_try . "}";
 }
 //echo "</table>";
 $textPingCurent = "";
 if ($pingTimeTotal == 0) {
     $lost = $pingCount - $pingCountOK;
     $rezultatPing = $ping_text_try_check . "<FONT color=gray>" . $ping_text_try . "</FONT>";
     if ($lost == 0) {
         for ($k = 0; $k < $pingCount; $k++) {
             if ($pingTime[$k] > 0) {
                 $pingTimeTotal = $pingTimeTotal + $pingTime[$k];
             }
         }
         $pingTimeTotal = $pingTimeTotal - $pingTryMax;
         $pingTimeFinal = (int) ($pingTimeTotal / ($pingCountOK - 1));
         SavePing($sh_host, $pingTimeFinal);
         $textPingCurent = " = " . $pingTimeFinal . "ms ";
     } else {
         if ($server_checkPing != "") {
             $textPingCurent = " = NOT SAVED";
         }
     }
 } else {
     if ($server_checkPing != "") {
         $rezultatPing = $ping_text_try_check . ": " . $LastPingError;
     } else {
         $rezultatPing = $ping_text_try_check;
     }
 }
 $bestPingSaved = SavedPing($sh_host);
 $textPingAverage = pingResultColor($bestPingSaved[0], 1);
Example #2
0
$cron_ping = true;
include "common.php";
loadServersHosts();
$bestPingSaved = SavedPing($sh_host);
if (rand(0, 1) == 0) {
    ksort($ServerHost_Conectat);
} else {
    krsort($ServerHost_Conectat);
}
foreach ($ServerHost_Conectat as $sh_host => $server_Time) {
    $bestPingSaved = SavedPing($sh_host);
    list($host_DNS, $host_PORT) = explode(":", $sh_host);
    if ($host_PORT > 0) {
        $host_IP = trim(getHostIP($host_DNS));
        usleep(100000);
        $pingTry1 = pingDomain($host_IP, $host_PORT, 1);
        if ($pingTry1 > 0) {
            usleep(100000);
            $pingTry2 = pingDomain($host_IP, $host_PORT, 1);
            if ($pingTry2 > 0) {
                usleep(100000);
                $pingTry3 = pingDomain($host_IP, $host_PORT, 1);
                if ($pingTry3 > 0) {
                    $pingMax = max($pingTry1, $pingTry2, $pingTry3);
                    $pingTry = (int) (($pingTry1 + $pingTry2 + $pingTry3 - $pingMax) / 2);
                    SavePing($sh_host, $pingTry);
                }
            }
        }
    }
}