mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-01 08:33:22 +02:00
Fix RDAP to correctly extract the TLD for multi-segment TLDs
This commit is contained in:
parent
9762e87ff6
commit
75eeef5f53
1 changed files with 7 additions and 1 deletions
|
@ -227,7 +227,13 @@ function handleDomainQuery($request, $response, $pdo, $domainName, $c, $log) {
|
|||
|
||||
// Extract TLD from the domain
|
||||
$parts = explode('.', $domain);
|
||||
|
||||
// Handle multi-segment TLDs (e.g., co.uk, ngo.us, etc.)
|
||||
if (count($parts) > 2) {
|
||||
$tld = "." . $parts[count($parts) - 2] . "." . $parts[count($parts) - 1];
|
||||
} else {
|
||||
$tld = "." . end($parts);
|
||||
}
|
||||
|
||||
// Check if the TLD exists in the domain_tld table
|
||||
$stmtTLD = $pdo->prepare("SELECT COUNT(*) FROM domain_tld WHERE tld = :tld");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue