mirror of
https://github.com/getnamingo/registry.git
synced 2025-06-28 15:13:27 +02:00
Cleanup
This commit is contained in:
parent
b7065fcaa6
commit
6181ece4de
9 changed files with 84 additions and 84 deletions
|
@ -94,37 +94,37 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform the DAS lookup
|
// Perform the DAS lookup
|
||||||
try {
|
try {
|
||||||
$query = "SELECT name FROM `registry`.`domain` WHERE `name` = :domain";
|
$query = "SELECT name FROM `registry`.`domain` WHERE `name` = :domain";
|
||||||
$stmt = $pdo->prepare($query);
|
$stmt = $pdo->prepare($query);
|
||||||
$stmt->bindParam(':domain', $domain, PDO::PARAM_STR);
|
$stmt->bindParam(':domain', $domain, PDO::PARAM_STR);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
if ($f = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
if ($f = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$server->send($fd, "1");
|
$server->send($fd, "1");
|
||||||
|
|
||||||
if ($fp = @fopen("/var/log/das/das_request.log",'a')) {
|
if ($fp = @fopen("/var/log/das/das_request.log",'a')) {
|
||||||
$clientInfo = $server->getClientInfo($fd);
|
$clientInfo = $server->getClientInfo($fd);
|
||||||
$remoteAddr = $clientInfo['remote_ip'];
|
$remoteAddr = $clientInfo['remote_ip'];
|
||||||
fwrite($fp,date('Y-m-d H:i:s')."\t-\t".$remoteAddr."\t-\t".$domain."\n");
|
fwrite($fp,date('Y-m-d H:i:s')."\t-\t".$remoteAddr."\t-\t".$domain."\n");
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
$server->close($fd);
|
$server->close($fd);
|
||||||
} else {
|
} else {
|
||||||
$server->send($fd, "0");
|
$server->send($fd, "0");
|
||||||
|
|
||||||
if ($fp = @fopen("/var/log/das/das_not_found.log",'a')) {
|
if ($fp = @fopen("/var/log/das/das_not_found.log",'a')) {
|
||||||
$clientInfo = $server->getClientInfo($fd);
|
$clientInfo = $server->getClientInfo($fd);
|
||||||
$remoteAddr = $clientInfo['remote_ip'];
|
$remoteAddr = $clientInfo['remote_ip'];
|
||||||
fwrite($fp,date('Y-m-d H:i:s')."\t-\t".$remoteAddr."\t-\t".$domain."\n");
|
fwrite($fp,date('Y-m-d H:i:s')."\t-\t".$remoteAddr."\t-\t".$domain."\n");
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
$server->close($fd);
|
$server->close($fd);
|
||||||
}
|
}
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
$server->send($fd, "Error connecting to the das database");
|
$server->send($fd, "Error connecting to the das database");
|
||||||
$server->close($fd);
|
$server->close($fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the connection
|
// Close the connection
|
||||||
$pdo = null;
|
$pdo = null;
|
|
@ -178,20 +178,20 @@ function handleDomainQuery($request, $response, $pdo, $domainName) {
|
||||||
$stmt1->execute();
|
$stmt1->execute();
|
||||||
$domainDetails = $stmt1->fetch(PDO::FETCH_ASSOC);
|
$domainDetails = $stmt1->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
// Check if the domain exists
|
// Check if the domain exists
|
||||||
if (!$domainDetails) {
|
if (!$domainDetails) {
|
||||||
// Domain not found, respond with a 404 error
|
// Domain not found, respond with a 404 error
|
||||||
$response->header('Content-Type', 'application/json');
|
$response->header('Content-Type', 'application/json');
|
||||||
$response->status(404);
|
$response->status(404);
|
||||||
$response->end(json_encode([
|
$response->end(json_encode([
|
||||||
'errorCode' => 404,
|
'errorCode' => 404,
|
||||||
'title' => 'Not Found',
|
'title' => 'Not Found',
|
||||||
'description' => 'The requested domain was not found in the RDAP database.',
|
'description' => 'The requested domain was not found in the RDAP database.',
|
||||||
]));
|
]));
|
||||||
// Close the connection
|
// Close the connection
|
||||||
$pdo = null;
|
$pdo = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Query 2: Get status details
|
// Query 2: Get status details
|
||||||
$stmt2 = $pdo->prepare("SELECT `status` FROM `domain_status` WHERE `domain_id` = :domain_id");
|
$stmt2 = $pdo->prepare("SELECT `status` FROM `domain_status` WHERE `domain_id` = :domain_id");
|
||||||
|
@ -350,11 +350,11 @@ function handleDomainQuery($request, $response, $pdo, $domainName) {
|
||||||
"This response conforms to the RDAP Operational Profile for gTLD Registries and Registrars version 1.0"
|
"This response conforms to the RDAP Operational Profile for gTLD Registries and Registrars version 1.0"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"description" => [
|
"description" => [
|
||||||
"For more information on domain status codes, please visit https://icann.org/epp"
|
"For more information on domain status codes, please visit https://icann.org/epp"
|
||||||
],
|
],
|
||||||
"links" => [
|
"links" => [
|
||||||
[
|
[
|
||||||
"href" => "https://icann.org/epp",
|
"href" => "https://icann.org/epp",
|
||||||
"rel" => "alternate",
|
"rel" => "alternate",
|
||||||
|
@ -363,11 +363,11 @@ function handleDomainQuery($request, $response, $pdo, $domainName) {
|
||||||
],
|
],
|
||||||
"title" => "Status Codes"
|
"title" => "Status Codes"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"description" => [
|
"description" => [
|
||||||
"URL of the ICANN RDDS Inaccuracy Complaint Form: https://icann.org/wicf"
|
"URL of the ICANN RDDS Inaccuracy Complaint Form: https://icann.org/wicf"
|
||||||
],
|
],
|
||||||
"links" => [
|
"links" => [
|
||||||
[
|
[
|
||||||
"href" => "https://icann.org/wicf",
|
"href" => "https://icann.org/wicf",
|
||||||
"rel" => "alternate",
|
"rel" => "alternate",
|
|
@ -156,7 +156,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
$server->send($fd, "Error connecting to the whois database");
|
$server->send($fd, "Error connecting to the whois database");
|
||||||
$server->close($fd);
|
$server->close($fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
elseif ($queryType == 'registrar') {
|
elseif ($queryType == 'registrar') {
|
||||||
|
@ -257,7 +257,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
$server->send($fd, "Error connecting to the whois database");
|
$server->send($fd, "Error connecting to the whois database");
|
||||||
$server->close($fd);
|
$server->close($fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -367,7 +367,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
$stmt5->execute();
|
$stmt5->execute();
|
||||||
|
|
||||||
$f2 = $stmt5->fetch(PDO::FETCH_ASSOC);
|
$f2 = $stmt5->fetch(PDO::FETCH_ASSOC);
|
||||||
if ($privacy) {
|
if ($privacy) {
|
||||||
$res .= "\nRegistry Registrant ID: REDACTED FOR PRIVACY"
|
$res .= "\nRegistry Registrant ID: REDACTED FOR PRIVACY"
|
||||||
."\nRegistrant Name: REDACTED FOR PRIVACY"
|
."\nRegistrant Name: REDACTED FOR PRIVACY"
|
||||||
."\nRegistrant Organization: REDACTED FOR PRIVACY"
|
."\nRegistrant Organization: REDACTED FOR PRIVACY"
|
||||||
|
@ -381,7 +381,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
."\nRegistrant Phone: REDACTED FOR PRIVACY"
|
."\nRegistrant Phone: REDACTED FOR PRIVACY"
|
||||||
."\nRegistrant Fax: REDACTED FOR PRIVACY"
|
."\nRegistrant Fax: REDACTED FOR PRIVACY"
|
||||||
."\nRegistrant Email: Kindly refer to the RDDS server associated with the identified registrar in this output to obtain contact details for the Registrant, Admin, or Tech associated with the queried domain name.";
|
."\nRegistrant Email: Kindly refer to the RDDS server associated with the identified registrar in this output to obtain contact details for the Registrant, Admin, or Tech associated with the queried domain name.";
|
||||||
} else {
|
} else {
|
||||||
$res .= "\nRegistry Registrant ID: ".$f2['identifier']
|
$res .= "\nRegistry Registrant ID: ".$f2['identifier']
|
||||||
."\nRegistrant Name: ".$f2['name']
|
."\nRegistrant Name: ".$f2['name']
|
||||||
."\nRegistrant Organization: ".$f2['org']
|
."\nRegistrant Organization: ".$f2['org']
|
||||||
|
@ -395,7 +395,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
."\nRegistrant Phone: ".$f2['voice']
|
."\nRegistrant Phone: ".$f2['voice']
|
||||||
."\nRegistrant Fax: ".$f2['fax']
|
."\nRegistrant Fax: ".$f2['fax']
|
||||||
."\nRegistrant Email: ".$f2['email'];
|
."\nRegistrant Email: ".$f2['email'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$query6 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.fax,contact.email
|
$query6 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.fax,contact.email
|
||||||
FROM domain_contact_map,contact,contact_postalInfo WHERE domain_contact_map.domain_id=:domain_id AND domain_contact_map.type='admin' AND domain_contact_map.contact_id=contact.id AND domain_contact_map.contact_id=contact_postalInfo.contact_id";
|
FROM domain_contact_map,contact,contact_postalInfo WHERE domain_contact_map.domain_id=:domain_id AND domain_contact_map.type='admin' AND domain_contact_map.contact_id=contact.id AND domain_contact_map.contact_id=contact_postalInfo.contact_id";
|
||||||
|
@ -404,7 +404,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
$stmt6->execute();
|
$stmt6->execute();
|
||||||
|
|
||||||
$f2 = $stmt6->fetch(PDO::FETCH_ASSOC);
|
$f2 = $stmt6->fetch(PDO::FETCH_ASSOC);
|
||||||
if ($privacy) {
|
if ($privacy) {
|
||||||
$res .= "\nRegistry Admin ID: REDACTED FOR PRIVACY"
|
$res .= "\nRegistry Admin ID: REDACTED FOR PRIVACY"
|
||||||
."\nAdmin Name: REDACTED FOR PRIVACY"
|
."\nAdmin Name: REDACTED FOR PRIVACY"
|
||||||
."\nAdmin Organization: REDACTED FOR PRIVACY"
|
."\nAdmin Organization: REDACTED FOR PRIVACY"
|
||||||
|
@ -418,7 +418,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
."\nAdmin Phone: REDACTED FOR PRIVACY"
|
."\nAdmin Phone: REDACTED FOR PRIVACY"
|
||||||
."\nAdmin Fax: REDACTED FOR PRIVACY"
|
."\nAdmin Fax: REDACTED FOR PRIVACY"
|
||||||
."\nAdmin Email: Kindly refer to the RDDS server associated with the identified registrar in this output to obtain contact details for the Registrant, Admin, or Tech associated with the queried domain name.";
|
."\nAdmin Email: Kindly refer to the RDDS server associated with the identified registrar in this output to obtain contact details for the Registrant, Admin, or Tech associated with the queried domain name.";
|
||||||
} else {
|
} else {
|
||||||
$res .= "\nRegistry Admin ID: ".$f2['identifier']
|
$res .= "\nRegistry Admin ID: ".$f2['identifier']
|
||||||
."\nAdmin Name: ".$f2['name']
|
."\nAdmin Name: ".$f2['name']
|
||||||
."\nAdmin Organization: ".$f2['org']
|
."\nAdmin Organization: ".$f2['org']
|
||||||
|
@ -432,7 +432,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
."\nAdmin Phone: ".$f2['voice']
|
."\nAdmin Phone: ".$f2['voice']
|
||||||
."\nAdmin Fax: ".$f2['fax']
|
."\nAdmin Fax: ".$f2['fax']
|
||||||
."\nAdmin Email: ".$f2['email'];
|
."\nAdmin Email: ".$f2['email'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$query7 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.fax,contact.email
|
$query7 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.fax,contact.email
|
||||||
FROM domain_contact_map,contact,contact_postalInfo WHERE domain_contact_map.domain_id=:domain_id AND domain_contact_map.type='billing' AND domain_contact_map.contact_id=contact.id AND domain_contact_map.contact_id=contact_postalInfo.contact_id";
|
FROM domain_contact_map,contact,contact_postalInfo WHERE domain_contact_map.domain_id=:domain_id AND domain_contact_map.type='billing' AND domain_contact_map.contact_id=contact.id AND domain_contact_map.contact_id=contact_postalInfo.contact_id";
|
||||||
|
@ -441,7 +441,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
$stmt7->execute();
|
$stmt7->execute();
|
||||||
|
|
||||||
$f2 = $stmt7->fetch(PDO::FETCH_ASSOC);
|
$f2 = $stmt7->fetch(PDO::FETCH_ASSOC);
|
||||||
if ($privacy) {
|
if ($privacy) {
|
||||||
$res .= "\nRegistry Billing ID: REDACTED FOR PRIVACY"
|
$res .= "\nRegistry Billing ID: REDACTED FOR PRIVACY"
|
||||||
."\nBilling Name: REDACTED FOR PRIVACY"
|
."\nBilling Name: REDACTED FOR PRIVACY"
|
||||||
."\nBilling Organization: REDACTED FOR PRIVACY"
|
."\nBilling Organization: REDACTED FOR PRIVACY"
|
||||||
|
@ -455,7 +455,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
."\nBilling Phone: REDACTED FOR PRIVACY"
|
."\nBilling Phone: REDACTED FOR PRIVACY"
|
||||||
."\nBilling Fax: REDACTED FOR PRIVACY"
|
."\nBilling Fax: REDACTED FOR PRIVACY"
|
||||||
."\nBilling Email: Kindly refer to the RDDS server associated with the identified registrar in this output to obtain contact details for the Registrant, Admin, or Tech associated with the queried domain name.";
|
."\nBilling Email: Kindly refer to the RDDS server associated with the identified registrar in this output to obtain contact details for the Registrant, Admin, or Tech associated with the queried domain name.";
|
||||||
} else {
|
} else {
|
||||||
$res .= "\nRegistry Billing ID: ".$f2['identifier']
|
$res .= "\nRegistry Billing ID: ".$f2['identifier']
|
||||||
."\nBilling Name: ".$f2['name']
|
."\nBilling Name: ".$f2['name']
|
||||||
."\nBilling Organization: ".$f2['org']
|
."\nBilling Organization: ".$f2['org']
|
||||||
|
@ -469,7 +469,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
."\nBilling Phone: ".$f2['voice']
|
."\nBilling Phone: ".$f2['voice']
|
||||||
."\nBilling Fax: ".$f2['fax']
|
."\nBilling Fax: ".$f2['fax']
|
||||||
."\nBilling Email: ".$f2['email'];
|
."\nBilling Email: ".$f2['email'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$query8 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.fax,contact.email
|
$query8 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.fax,contact.email
|
||||||
FROM domain_contact_map,contact,contact_postalInfo WHERE domain_contact_map.domain_id=:domain_id AND domain_contact_map.type='tech' AND domain_contact_map.contact_id=contact.id AND domain_contact_map.contact_id=contact_postalInfo.contact_id";
|
FROM domain_contact_map,contact,contact_postalInfo WHERE domain_contact_map.domain_id=:domain_id AND domain_contact_map.type='tech' AND domain_contact_map.contact_id=contact.id AND domain_contact_map.contact_id=contact_postalInfo.contact_id";
|
||||||
|
@ -478,7 +478,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
$stmt8->execute();
|
$stmt8->execute();
|
||||||
|
|
||||||
$f2 = $stmt8->fetch(PDO::FETCH_ASSOC);
|
$f2 = $stmt8->fetch(PDO::FETCH_ASSOC);
|
||||||
if ($privacy) {
|
if ($privacy) {
|
||||||
$res .= "\nRegistry Tech ID: REDACTED FOR PRIVACY"
|
$res .= "\nRegistry Tech ID: REDACTED FOR PRIVACY"
|
||||||
."\nTech Name: REDACTED FOR PRIVACY"
|
."\nTech Name: REDACTED FOR PRIVACY"
|
||||||
."\nTech Organization: REDACTED FOR PRIVACY"
|
."\nTech Organization: REDACTED FOR PRIVACY"
|
||||||
|
@ -492,7 +492,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
."\nTech Phone: REDACTED FOR PRIVACY"
|
."\nTech Phone: REDACTED FOR PRIVACY"
|
||||||
."\nTech Fax: REDACTED FOR PRIVACY"
|
."\nTech Fax: REDACTED FOR PRIVACY"
|
||||||
."\nTech Email: Kindly refer to the RDDS server associated with the identified registrar in this output to obtain contact details for the Registrant, Admin, or Tech associated with the queried domain name.";
|
."\nTech Email: Kindly refer to the RDDS server associated with the identified registrar in this output to obtain contact details for the Registrant, Admin, or Tech associated with the queried domain name.";
|
||||||
} else {
|
} else {
|
||||||
$res .= "\nRegistry Tech ID: ".$f2['identifier']
|
$res .= "\nRegistry Tech ID: ".$f2['identifier']
|
||||||
."\nTech Name: ".$f2['name']
|
."\nTech Name: ".$f2['name']
|
||||||
."\nTech Organization: ".$f2['org']
|
."\nTech Organization: ".$f2['org']
|
||||||
|
@ -506,7 +506,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
."\nTech Phone: ".$f2['voice']
|
."\nTech Phone: ".$f2['voice']
|
||||||
."\nTech Fax: ".$f2['fax']
|
."\nTech Fax: ".$f2['fax']
|
||||||
."\nTech Email: ".$f2['email'];
|
."\nTech Email: ".$f2['email'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$query9 = "SELECT `name` FROM `domain_host_map`,`host` WHERE `domain_host_map`.`domain_id` = :domain_id AND `domain_host_map`.`host_id` = `host`.`id`";
|
$query9 = "SELECT `name` FROM `domain_host_map`,`host` WHERE `domain_host_map`.`domain_id` = :domain_id AND `domain_host_map`.`host_id` = `host`.`id`";
|
||||||
$stmt9 = $pdo->prepare($query9);
|
$stmt9 = $pdo->prepare($query9);
|
Loading…
Add table
Add a link
Reference in a new issue