20 lines
497 B
PHP
20 lines
497 B
PHP
<?php
|
|
|
|
function wakeOnLan($macAddress) {
|
|
$output = shell_exec("wakeonlan " . escapeshellarg($macAddress));
|
|
if ($output === null) {
|
|
return "Failed to send Magic Packet.";
|
|
}
|
|
return true;
|
|
return true;
|
|
}
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$macAddress = $_POST['target'];
|
|
$result = wakeOnLan($macAddress);
|
|
if ($result === true) {
|
|
$message = "Magic Packet sent successfully!";
|
|
} else {
|
|
$message = $result;
|
|
}
|
|
} |