Browse Source

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

master
Jannik Beyerstedt 2 years ago
parent
commit
8446cfe206
2 changed files with 17 additions and 1 deletions
  1. 1
    0
      .gitignore
  2. 16
    1
      index.php

+ 1
- 0
.gitignore View File

@@ -0,0 +1 @@
.AppleDouble

+ 16
- 1
index.php 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>

Loading…
Cancel
Save