Suchen
Aktuell
- Aktuell
- Kommentare
- TagCloud
- Windows Phone 7: Silverlight und XNA
- 1267769400 1267769400 - Keine Kommentare
- Empfehlung: Microsoft Arc Keyboard
- 1266747660 1266747660 - 2 Kommentare
- C#: Outlook like Pop-up Alert
- 1264008720 1264008720 - Keine Kommentare
- Windows Mobile 7 - Verschiedene Versionen geplant
- 1264007340 1264007340 - Keine Kommentare
- Windows Media Center: Pixelfehler am rechten Rand
- 1260208800 1260208800 - Keine Kommentare
- Das Outlook Fenster kann nicht geöffnet werden #2
- 1259409180 1259409180 - 13 Kommentare
- Bis jetzt sind noch keine Kommentare geschrieben worden
Randnotiz
W3C
- Keine Kommentare
Funtion: ping($ip)
Folgende Funktion führt einen Ping auf die angegebene IP-Adresse ($ip) aus und liefert die Ping-Zeit zurück. Sollte die IP nicht erreichbar sein, wird 0.0 zurückgegeben.
Hinweis: Damit diese Funktion funktioniert, muss shell_exec auf dem Server erlaubt sein
function ping($ip) {
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
if(strtoupper(substr(PHP_OS, 0, 3)) == 'WIN')
$command = shell_exec('ping -n 1 '.$ip);
else
$command = shell_exec('ping -c 1 '.$ip);
if(eregi('100%', $command)) {
return '0.0';
} else {
$start = strpos($command, 'time=') + 5;
$ende = strpos($command, 'ms');
$mstime = substr($command, $start, $ende-$start);
return $mstime;
}
} else {
return '0.0';
}
}
Kommentare
- Bis jetzt sind noch keine Kommentare geschrieben worden


