diff --git a/rdp.php b/rdp.php
index c4664b8..2ecc7af 100644
--- a/rdp.php
+++ b/rdp.php
@@ -1,6 +1,10 @@
 <?php
 
-header('Content-Disposition: attachment; filename='.str_replace(':', '_', $_GET['v']).'.rdp');
+$host = filter_input(INPUT_GET, 'v', FILTER_VALIDATE_DOMAIN) ?: filter_input(INPUT_GET, 'v', FILTER_VALIDATE_IP);
+if (!$host) {
+    exit();
+}
+
+header('Content-Disposition: attachment; filename='.str_replace(':', '_', $host).'.rdp');
 header('Content-Type: application/rdp');
-echo "full address:s:${_GET['v']}\n";
-exit();
+echo "full address:s:$host\n";