21 lines
539 B
PHP
21 lines
539 B
PHP
|
<?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['hostname'])) {
|
||
|
$foo = array(); $status;
|
||
|
exec("ping -c 1 ".$_GET['hostname'], $foo, $status);
|
||
|
if (!$status) {
|
||
|
echo "1 online";
|
||
|
} else {
|
||
|
echo "0 offline";
|
||
|
}
|
||
|
} else {
|
||
|
header("HTTP/1.1 400 Bad Request");
|
||
|
echo "ERROR: invalid request";
|
||
|
}
|