Skip to content

Instantly share code, notes, and snippets.

@luanlmd
Created December 2, 2010 19:16
Show Gist options
  • Save luanlmd/725875 to your computer and use it in GitHub Desktop.
Save luanlmd/725875 to your computer and use it in GitHub Desktop.
Check if the PC is alone in the network
#!/usr/bin/php5 -q
<?php
$broadcast = "10.55.2.255";
$ignore = array('10.55.2.240','10.55.2.66');
$ignore = implode('|',$ignore);
$string = "ping -b {$broadcast} -c 2 | grep 'icmp_req=1' | grep -vE '{$ignore}'";
$result = shell_exec($string);
if (trim($result))
{
exit('false');
}
exit('true');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment