"; echo $output; echo ""; exit; } // Get the port $port = isset($_GET['port']) ? $_GET['port'] : 9; // Validate the port if (!filter_var($port, FILTER_VALIDATE_INT, array('options' => array('min_range' => 1, 'max_range' => 65535)))) { // Error message $output = lang('DevDetail_Tab_Tools_WOL_Error_Port'); // Show the result echo "
";
	echo $output;
	echo "
"; exit; } // Get password $password = isset($_GET['password']) ? $_GET['password'] : ''; // Validate the password (regular expression requires that the password has at least 8 characters, a lowercase letter, an uppercase letter and a number) //if (!filter_var($password, FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => '/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$/')))) { // Error message // $output = lang('DevDetail_Tab_Tools_WOL_Error_Password'); // Show the result // echo "
";
//	echo $output;
//	echo "
"; // exit; //} // Create the magic packet $magicPacket = pack('H*', 'FF FF FF FF FF FF FF ' . $mac); // Create a UDP socket $socket = socket_create(AF_INET, SOCK_DGRAM, IPPROTO_UDP); // Set the socket options socket_set_option($socket, SOL_SOCKET, SO_BROADCAST, true); // Send the WoL packet socket_sendto($socket, $magicPacket, strlen($magicPacket), 0, '255.255.255.255', $port); // Close the socket socket_close($socket); // Print a message to indicate that the device has been woken up echo "
";
$output = lang('DevDetail_Tab_Tools_WOL_Message');
echo $output;
echo "
"; ?>