2023-08-10 17:36:39 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$domain = $_GET['domain'] ?? '';
|
|
|
|
|
|
|
|
if (strpos($domain, '.') === false) {
|
|
|
|
http_response_code(400);
|
|
|
|
} elseif (strpos($domain, '/') !== false) {
|
|
|
|
http_response_code(400);
|
|
|
|
} elseif (strpos($domain, ':') !== false) {
|
|
|
|
http_response_code(400);
|
|
|
|
} elseif (!filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
|
|
|
|
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);
|
|
|
|
}
|