AddOn/SystemTest/ping.php hinzugefügt

This commit is contained in:
olinet 2025-07-08 12:30:13 +02:00
parent f9c9c8eefe
commit 286a2a3043
1 changed files with 26 additions and 0 deletions

26
AddOn/SystemTest/ping.php Normal file
View File

@ -0,0 +1,26 @@
<?php
if (pingServer($_GET['SERVER'])) {
echo "Server ".$_GET['SERVER']." ist erreichbar.";
} else {
echo "Server ".$_GET['SERVER']." ist NICHT erreichbar.";
}
function pingServer($host, $count = 1)
{
$output = [];
$status = null;
// Windows oder Unix ping
$pingCmd = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
? "ping -n {$count} {$host}"
: "ping -c {$count} {$host}";
exec($pingCmd, $output, $status);
return $status === 0;
}
?>