2017-09-22 00:13:04 +02:00
< ? php
// -------------------------------------------
// Wake On LAN Webclient -- on private LAN
// copyright: Jannik Beyerstedt | https://jannikbeyerstedt.de
// license: http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 License
// -------------------------------------------
if ( isset ( $_GET [ 'wake' ])) {
$return = shell_exec ( 'wakeonlan ' . $_GET [ 'wake' ]);
}
2017-09-23 23:16:39 +02:00
$clients = [ " nuc6i5-host " => " b8:ae:ed:ec:18:f7 " ,
" magrathea " => " 60:03:08:9c:25:6a " ];
2017-09-22 00:13:04 +02:00
?>
<! DOCTYPE html >
< html lang = " de " >
< head >
< meta charset = " utf-8 " >
< meta name = " viewport " content = " width=device-width, initial-scale=1.0 " >
< title > WakeOnLan @ UrsaMinor . fra80 </ title >
< style >
body {
max - width : 500 px ;
margin : 0 auto ;
padding : 0 5 px ;
font - family : - apple - system , BlinkMacSystemFont , " Segoe UI " , Roboto , " Helvetica Neue " , Arial , sans - serif , " Apple Color Emoji " , " Segoe UI Emoji " , " Segoe UI Symbol " ;
}
small {
font - size : 0.7 em ;
font - weight : 500 ;
}
li {
margin - bottom : 1.5 em ;
}
a , a : visited {
color : blue ;
}
2017-09-23 23:16:39 +02:00
. red { color : red ; }
. green { color : green ; }
2017-09-22 00:13:04 +02:00
</ style >
</ head >
< body >
< h1 > Wake On LAN Service </ h1 >
< ? php if ( isset ( $return )) : ?>
< p > The command returned :</ p >
< pre >< ? php echo $return ; ?> </pre>
< a href = " index.php " > OK </ a >
< ? php endif ; ?>
< p > I can wake up the following clients :</ p >
< ul >
2017-09-23 23:16:39 +02:00
< ? 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 ; ?>
2017-09-22 00:13:04 +02:00
</ ul >
</ body >
</ html >