mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-03 09:33:25 +02:00
Fix WHOIS to correctly extract the TLD for multi-segment TLDs (or SLDs) such as co.uk
, ngo.us
This commit is contained in:
parent
51a0a7215c
commit
9762e87ff6
1 changed files with 7 additions and 1 deletions
|
@ -111,7 +111,13 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) use ($c, $pool
|
||||||
|
|
||||||
// Extract TLD from the domain and prepend a dot
|
// Extract TLD from the domain and prepend a dot
|
||||||
$parts = explode('.', $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);
|
$tld = "." . end($parts);
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the TLD exists in the domain_tld table
|
// Check if the TLD exists in the domain_tld table
|
||||||
$stmtTLD = $pdo->prepare("SELECT COUNT(*) FROM domain_tld WHERE tld = :tld");
|
$stmtTLD = $pdo->prepare("SELECT COUNT(*) FROM domain_tld WHERE tld = :tld");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue