<?php
$file = file('test.txt');
$i = 0;
foreach($file as $line)
{
$i++;
$arr = explode(';', $line);
$v = echo '<pre>' . $arr[0] . '</pre>' ;
$ip = echo '<pre>' . $arr[1] . '</pre>' ;
exec("ping -c 1 -w 200 $ip",$output, $status);
if ($status==0)
echo "<a href='http://$ip.'<br>':8080' title='$v'<br>''>Online</a>\n";
else
echo "<a href='http://$ip.'<br>':8080' title='$v'<br>''>Offline</a>\n";
}
?>
$v = echo '<pre>' . $arr[0] . '</pre>' ;
$ip = echo '<pre>' . $arr[1] . '</pre>' ;
<?php
$file = file('test.txt');
$i = 0;
foreach($file as $line) {
$i++;
$arr = explode(';', $line);
$v = $arr[0];
$ip = $arr[1];
$output = shell_exec("ping $ip -n 1");
$text = iconv("cp866","utf-8", $output);
$pos = strpos($text, "потеряно = 1");
if ( $pos > 0 ) {
echo "<a href='http://$ip:8080' title='$v'>Offline</a><br>";
} else {
if (strlen($text) > 300 ) {
echo "<a href='http://$ip:8080' title='$v'>Online</a><br>";
} else {
echo "<a href='http://$ip:8080' title='$v'>-</a><br>";
}
}
}
?>
<?php
header('Content-type: text/html; charset=utf-8')
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<?php
$file = file('test.txt');
$i = 0;
foreach ($file as $line) {
$i++;
$arr = explode(';', $line);
$ip = $arr[0];
$output = shell_exec("ping $ip -n 1");
$text = iconv("CP866", "utf-8", $output);
$pos = strpos($text, "недоступен");
// echo $pos;
// echo $text;
if ($pos > 0) {
echo "<a href='http://$ip:8080' title='$ip'>Offline</a><br>";
} elseif (strlen($text) > 300) {
echo "<a href='http://$ip:8080' title='$ip'>Online</a><br>";
} else {
echo "<a href='http://$ip:8080' title='$ip'>-</a><br>";
}
}
?>
</body>
</html>