2023-08-10 17:36:39 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$domain = $_GET['domain'] ?? '';
|
|
|
|
|
2024-06-24 20:32:14 +08:00
|
|
|
if (!str_contains($domain, '.')) {
|
2023-08-10 17:36:39 +08:00
|
|
|
http_response_code(400);
|
2024-06-24 20:32:14 +08:00
|
|
|
} elseif (str_contains($domain, '/')) {
|
2023-08-10 17:36:39 +08:00
|
|
|
http_response_code(400);
|
2024-06-24 20:32:14 +08:00
|
|
|
} elseif (str_contains($domain, ':')) {
|
2023-08-10 17:36:39 +08:00
|
|
|
http_response_code(400);
|
2024-01-25 19:17:43 +08:00
|
|
|
} elseif (filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) === false) {
|
2023-08-10 17:36:39 +08:00
|
|
|
http_response_code(400);
|
|
|
|
} elseif (filter_var($domain, FILTER_VALIDATE_IP)) {
|
|
|
|
http_response_code(400);
|
|
|
|
} else {
|
2023-08-10 21:46:40 +08:00
|
|
|
// Commented because logging is disabled as otherwise all attempts will be logged which spams the logs
|
|
|
|
// error_log($domain . ' was accepted as valid domain.');
|
2023-08-10 17:36:39 +08:00
|
|
|
http_response_code(200);
|
|
|
|
}
|