Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form name='scoretable' method='post' action='test.php'>
- <textarea wrap="on" class="but" rows="10" cols="20" name="toPingList"></textarea>
- <input type="submit" value="Tjek PC'ere" name="B1">
- </form>
- //Indtast PCere med komma separering. PC1,PC2,PC3 ....
- <?php
- $toPing = preg_split("/[\s]*[,][\s]*/", $_POST["toPingList"]);
- $pass = array();
- $fail = array();
- // initialization
- $output = array();
- $retval = 0;
- foreach($toPing as $ip) {
- exec("ping -w 1 " . $ip, $output, $retval);
- if($retval == 0) {
- $pass[] = $ip;
- } else {
- $fail[] = $ip;
- }
- }
- echo "Tændt: \n";
- print_r($pass);
- echo "<br><br>";
- echo "Slukket: \n";
- print_r($fail);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment