[CODE] add information if host is up (via ping)

This commit is contained in:
Jannik Beyerstedt 2017-09-23 23:16:39 +02:00
parent dab8525bae
commit 8446cfe206
2 changed files with 17 additions and 1 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.AppleDouble

View file

@ -10,6 +10,8 @@ if (isset($_GET['wake'])) {
$return = shell_exec('wakeonlan '.$_GET['wake']);
}
$clients = ["nuc6i5-host"=>"b8:ae:ed:ec:18:f7",
"magrathea" =>"60:03:08:9c:25:6a"];
?>
<!DOCTYPE html>
@ -35,6 +37,9 @@ if (isset($_GET['wake'])) {
a, a:visited {
color: blue;
}
.red { color: red; }
.green { color: green; }
</style>
</head>
<body>
@ -46,7 +51,17 @@ if (isset($_GET['wake'])) {
<?php endif; ?>
<p>I can wake up the following clients:</p>
<ul>
<li><a href="?wake=b8:ae:ed:ec:18:f7">nuc6i5-host (b8:ae:ed:ec:18:f7)</a></li>
<?php foreach ($clients as $name=>$mac) : ?>
<li>
<a href="?wake=<?php echo $mac ?>"><?php echo $name ?> (<?php echo $mac ?>)</a>
<?php $foo = array(); $status; exec("ping -c 1 ".$name.".fra80", $foo, $status); ?>
<?php if (!$status) : ?>
<span class="green">&#8226;</span> online
<?php else : ?>
<span class="red">&#8226;</span> offline
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</body>
</html>