<?php
if (isset($_GET['ip'])) {
    $ip = $_GET['ip'];
    $output = array();
    exec("ping ".$ip." -c 1 -W 1", $output);

    if (strpos($output[3], '1 packets received') !== false) {
        echo 'success';
    } else {
        echo 'failure';
    }
}
?>
