$info[10]["name"]="021 - Deer Park";
$info[10]["address"]="100.100.196.227";
$infocount = 10;
$online = 0;
$offline = 0;
echo '<div id=header><div id=status1><table border="0" align=left>';
for($i=0; $i<=$infocount; $i++){
$ipconnect = "Packets: Sent = 1, Received= 0, Lost = 1 (100% loss)," ;
$currentip = $info[$i]["address"];
exec("ping -n 1 $currentip", $output, $ret_val);
if ( $ret_val == $ipconnect) {
echo "<tr><td><span class=green><a href=http://" . $info[$i]["address"] . ">" . $info[$i]["name"] . "</a></span></tr></td>";
$online++;
}else{
echo "<tr><td><span class=red>" . $info[$i]["name"] . "</span></tr></td>";
$offline++;
}
}
echo '</tr></table></div>';
echo "DVRs Online: " . $online . "<br>DVRs Offline: " . $offline . "<br></div>";
?>
Seems like i have it working now (using the 3 parameters for "exec") but im wondering if i couldnt be doing this more efficiently.
The first code snippet is an example of one the array elements. You can see that it goes through the 'for' loop and prints the status as it goes. This is causing a hiccup later on when I want to print the total online and total offline at the TOP of the page... I have no clue how to do this.
Im also wondering if an array is the quickest way to do this. If i have to add a dvr later on, it will require retyping all the index numbers so as to keep them in numerical order.
here is a screenshot (attached) of my output thus far:
[attachment deleted by admin]