mirror of
https://github.com/getnamingo/registry.git
synced 2025-06-28 07:03:28 +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
|
||||
try {
|
||||
$query = "SELECT name FROM `registry`.`domain` WHERE `name` = :domain";
|
||||
$stmt = $pdo->prepare($query);
|
||||
$stmt->bindParam(':domain', $domain, PDO::PARAM_STR);
|
||||
$stmt->execute();
|
||||
try {
|
||||
$query = "SELECT name FROM `registry`.`domain` WHERE `name` = :domain";
|
||||
$stmt = $pdo->prepare($query);
|
||||
$stmt->bindParam(':domain', $domain, PDO::PARAM_STR);
|
||||
$stmt->execute();
|
||||
|
||||
if ($f = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$server->send($fd, "1");
|
||||
if ($f = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$server->send($fd, "1");
|
||||
|
||||
if ($fp = @fopen("/var/log/das/das_request.log",'a')) {
|
||||
$clientInfo = $server->getClientInfo($fd);
|
||||
$remoteAddr = $clientInfo['remote_ip'];
|
||||
fwrite($fp,date('Y-m-d H:i:s')."\t-\t".$remoteAddr."\t-\t".$domain."\n");
|
||||
fclose($fp);
|
||||
}
|
||||
$server->close($fd);
|
||||
} else {
|
||||
$server->send($fd, "0");
|
||||
if ($fp = @fopen("/var/log/das/das_request.log",'a')) {
|
||||
$clientInfo = $server->getClientInfo($fd);
|
||||
$remoteAddr = $clientInfo['remote_ip'];
|
||||
fwrite($fp,date('Y-m-d H:i:s')."\t-\t".$remoteAddr."\t-\t".$domain."\n");
|
||||
fclose($fp);
|
||||
}
|
||||
$server->close($fd);
|
||||
} else {
|
||||
$server->send($fd, "0");
|
||||
|
||||
if ($fp = @fopen("/var/log/das/das_not_found.log",'a')) {
|
||||
$clientInfo = $server->getClientInfo($fd);
|
||||
$remoteAddr = $clientInfo['remote_ip'];
|
||||
fwrite($fp,date('Y-m-d H:i:s')."\t-\t".$remoteAddr."\t-\t".$domain."\n");
|
||||
fclose($fp);
|
||||
}
|
||||
$server->close($fd);
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
if ($fp = @fopen("/var/log/das/das_not_found.log",'a')) {
|
||||
$clientInfo = $server->getClientInfo($fd);
|
||||
$remoteAddr = $clientInfo['remote_ip'];
|
||||
fwrite($fp,date('Y-m-d H:i:s')."\t-\t".$remoteAddr."\t-\t".$domain."\n");
|
||||
fclose($fp);
|
||||
}
|
||||
$server->close($fd);
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
$server->send($fd, "Error connecting to the das database");
|
||||
$server->close($fd);
|
||||
}
|
||||
}
|
||||
|
||||
// Close the connection
|
||||
$pdo = null;
|
|
@ -178,20 +178,20 @@ function handleDomainQuery($request, $response, $pdo, $domainName) {
|
|||
$stmt1->execute();
|
||||
$domainDetails = $stmt1->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
// Check if the domain exists
|
||||
if (!$domainDetails) {
|
||||
// Domain not found, respond with a 404 error
|
||||
$response->header('Content-Type', 'application/json');
|
||||
$response->status(404);
|
||||
$response->end(json_encode([
|
||||
'errorCode' => 404,
|
||||
'title' => 'Not Found',
|
||||
'description' => 'The requested domain was not found in the RDAP database.',
|
||||
]));
|
||||
// Close the connection
|
||||
$pdo = null;
|
||||
return;
|
||||
}
|
||||
// Check if the domain exists
|
||||
if (!$domainDetails) {
|
||||
// Domain not found, respond with a 404 error
|
||||
$response->header('Content-Type', 'application/json');
|
||||
$response->status(404);
|
||||
$response->end(json_encode([
|
||||
'errorCode' => 404,
|
||||
'title' => 'Not Found',
|
||||
'description' => 'The requested domain was not found in the RDAP database.',
|
||||
]));
|
||||
// Close the connection
|
||||
$pdo = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// Query 2: Get status details
|
||||
$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"
|
||||
]
|
||||
],
|
||||
[
|
||||
[
|
||||
"description" => [
|
||||
"For more information on domain status codes, please visit https://icann.org/epp"
|
||||
],
|
||||
"links" => [
|
||||
"links" => [
|
||||
[
|
||||
"href" => "https://icann.org/epp",
|
||||
"rel" => "alternate",
|
||||
|
@ -363,11 +363,11 @@ function handleDomainQuery($request, $response, $pdo, $domainName) {
|
|||
],
|
||||
"title" => "Status Codes"
|
||||
],
|
||||
[
|
||||
[
|
||||
"description" => [
|
||||
"URL of the ICANN RDDS Inaccuracy Complaint Form: https://icann.org/wicf"
|
||||
],
|
||||
"links" => [
|
||||
"links" => [
|
||||
[
|
||||
"href" => "https://icann.org/wicf",
|
||||
"rel" => "alternate",
|
|
@ -156,7 +156,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
|||
} catch (PDOException $e) {
|
||||
$server->send($fd, "Error connecting to the whois database");
|
||||
$server->close($fd);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($queryType == 'registrar') {
|
||||
|
@ -257,7 +257,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
|||
} catch (PDOException $e) {
|
||||
$server->send($fd, "Error connecting to the whois database");
|
||||
$server->close($fd);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
@ -367,7 +367,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
|||
$stmt5->execute();
|
||||
|
||||
$f2 = $stmt5->fetch(PDO::FETCH_ASSOC);
|
||||
if ($privacy) {
|
||||
if ($privacy) {
|
||||
$res .= "\nRegistry Registrant ID: REDACTED FOR PRIVACY"
|
||||
."\nRegistrant Name: 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 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.";
|
||||
} else {
|
||||
} else {
|
||||
$res .= "\nRegistry Registrant ID: ".$f2['identifier']
|
||||
."\nRegistrant Name: ".$f2['name']
|
||||
."\nRegistrant Organization: ".$f2['org']
|
||||
|
@ -395,7 +395,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
|||
."\nRegistrant Phone: ".$f2['voice']
|
||||
."\nRegistrant Fax: ".$f2['fax']
|
||||
."\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
|
||||
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();
|
||||
|
||||
$f2 = $stmt6->fetch(PDO::FETCH_ASSOC);
|
||||
if ($privacy) {
|
||||
if ($privacy) {
|
||||
$res .= "\nRegistry Admin ID: REDACTED FOR PRIVACY"
|
||||
."\nAdmin Name: 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 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.";
|
||||
} else {
|
||||
} else {
|
||||
$res .= "\nRegistry Admin ID: ".$f2['identifier']
|
||||
."\nAdmin Name: ".$f2['name']
|
||||
."\nAdmin Organization: ".$f2['org']
|
||||
|
@ -432,7 +432,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
|||
."\nAdmin Phone: ".$f2['voice']
|
||||
."\nAdmin Fax: ".$f2['fax']
|
||||
."\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
|
||||
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();
|
||||
|
||||
$f2 = $stmt7->fetch(PDO::FETCH_ASSOC);
|
||||
if ($privacy) {
|
||||
if ($privacy) {
|
||||
$res .= "\nRegistry Billing ID: REDACTED FOR PRIVACY"
|
||||
."\nBilling Name: 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 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.";
|
||||
} else {
|
||||
} else {
|
||||
$res .= "\nRegistry Billing ID: ".$f2['identifier']
|
||||
."\nBilling Name: ".$f2['name']
|
||||
."\nBilling Organization: ".$f2['org']
|
||||
|
@ -469,7 +469,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
|||
."\nBilling Phone: ".$f2['voice']
|
||||
."\nBilling Fax: ".$f2['fax']
|
||||
."\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
|
||||
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();
|
||||
|
||||
$f2 = $stmt8->fetch(PDO::FETCH_ASSOC);
|
||||
if ($privacy) {
|
||||
if ($privacy) {
|
||||
$res .= "\nRegistry Tech ID: REDACTED FOR PRIVACY"
|
||||
."\nTech Name: 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 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.";
|
||||
} else {
|
||||
} else {
|
||||
$res .= "\nRegistry Tech ID: ".$f2['identifier']
|
||||
."\nTech Name: ".$f2['name']
|
||||
."\nTech Organization: ".$f2['org']
|
||||
|
@ -506,7 +506,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
|
|||
."\nTech Phone: ".$f2['voice']
|
||||
."\nTech Fax: ".$f2['fax']
|
||||
."\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`";
|
||||
$stmt9 = $pdo->prepare($query9);
|
Loading…
Add table
Add a link
Reference in a new issue