mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-16 17:46:59 +02:00
Potential EPP Swoole issue fixed in check and renew
This commit is contained in:
parent
6b53150a19
commit
a89a09a381
2 changed files with 18 additions and 0 deletions
|
@ -18,6 +18,7 @@ function processContactCheck($conn, $db, $xml, $trans) {
|
||||||
$stmt->execute(['id' => $contactID]);
|
$stmt->execute(['id' => $contactID]);
|
||||||
|
|
||||||
$results[$contactID] = $stmt->fetch() ? '0' : '1'; // 0 if exists, 1 if not
|
$results[$contactID] = $stmt->fetch() ? '0' : '1'; // 0 if exists, 1 if not
|
||||||
|
$stmt->closeCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
$ids = [];
|
$ids = [];
|
||||||
|
@ -85,6 +86,7 @@ function processHostCheck($conn, $db, $xml, $trans) {
|
||||||
$stmt->execute(['name' => $host]);
|
$stmt->execute(['name' => $host]);
|
||||||
|
|
||||||
$results[$host] = $stmt->fetch() ? '0' : '1'; // 0 if exists, 1 if not
|
$results[$host] = $stmt->fetch() ? '0' : '1'; // 0 if exists, 1 if not
|
||||||
|
$stmt->closeCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
$names = [];
|
$names = [];
|
||||||
|
@ -157,6 +159,7 @@ function processDomainCheck($conn, $db, $xml, $trans, $clid) {
|
||||||
$stmt->bindParam(':domainName', $label, PDO::PARAM_STR);
|
$stmt->bindParam(':domainName', $label, PDO::PARAM_STR);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$claim_key = $stmt->fetchColumn();
|
$claim_key = $stmt->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if ($claim_key) {
|
if ($claim_key) {
|
||||||
$domainEntry[] = 1;
|
$domainEntry[] = 1;
|
||||||
|
@ -200,6 +203,7 @@ function processDomainCheck($conn, $db, $xml, $trans, $clid) {
|
||||||
$stmt->bindParam(':phase', $launchPhaseName, PDO::PARAM_STR);
|
$stmt->bindParam(':phase', $launchPhaseName, PDO::PARAM_STR);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$taken = $stmt->fetchColumn();
|
$taken = $stmt->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
$availability = $taken ? '0' : '1';
|
$availability = $taken ? '0' : '1';
|
||||||
|
|
||||||
// Initialize a new domain entry with the domain name
|
// Initialize a new domain entry with the domain name
|
||||||
|
@ -218,6 +222,7 @@ function processDomainCheck($conn, $db, $xml, $trans, $clid) {
|
||||||
$stmt->bindParam(':domainName', $label, PDO::PARAM_STR);
|
$stmt->bindParam(':domainName', $label, PDO::PARAM_STR);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$reserved = $stmt->fetchColumn();
|
$reserved = $stmt->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if ($reserved) {
|
if ($reserved) {
|
||||||
$domainEntry[] = 0; // Set status to unavailable
|
$domainEntry[] = 0; // Set status to unavailable
|
||||||
|
@ -278,6 +283,7 @@ function processDomainCheck($conn, $db, $xml, $trans, $clid) {
|
||||||
$stmt->bindParam(':label', $label, PDO::PARAM_STR);
|
$stmt->bindParam(':label', $label, PDO::PARAM_STR);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
if ($result['type'] === 'taken') {
|
if ($result['type'] === 'taken') {
|
||||||
|
@ -293,6 +299,7 @@ function processDomainCheck($conn, $db, $xml, $trans, $clid) {
|
||||||
$stmt->bindParam(':token', $allocationTokenValue, PDO::PARAM_STR);
|
$stmt->bindParam(':token', $allocationTokenValue, PDO::PARAM_STR);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$token = $stmt->fetchColumn();
|
$token = $stmt->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if ($token) {
|
if ($token) {
|
||||||
$domainEntry[] = 1; // Available with a valid allocation token
|
$domainEntry[] = 1; // Available with a valid allocation token
|
||||||
|
@ -366,6 +373,7 @@ function processDomainCheck($conn, $db, $xml, $trans, $clid) {
|
||||||
$stmt->bindParam(':domain_extension', $domain_extension, PDO::PARAM_STR);
|
$stmt->bindParam(':domain_extension', $domain_extension, PDO::PARAM_STR);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if ($result != false) {
|
if ($result != false) {
|
||||||
$tld_id = $result['id'];
|
$tld_id = $result['id'];
|
||||||
|
|
|
@ -42,11 +42,13 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
$stmt->bindParam(':clid', $clid, PDO::PARAM_STR);
|
$stmt->bindParam(':clid', $clid, PDO::PARAM_STR);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$clid = $stmt->fetch(PDO::FETCH_ASSOC);
|
$clid = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$stmt = $db->prepare("SELECT id, name, tldid, exdate, clid FROM domain WHERE name = :domainName LIMIT 1");
|
$stmt = $db->prepare("SELECT id, name, tldid, exdate, clid FROM domain WHERE name = :domainName LIMIT 1");
|
||||||
$stmt->bindParam(':domainName', $domainName, PDO::PARAM_STR);
|
$stmt->bindParam(':domainName', $domainName, PDO::PARAM_STR);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$domainData = $stmt->fetch(PDO::FETCH_ASSOC);
|
$domainData = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if (!$domainData) {
|
if (!$domainData) {
|
||||||
sendEppError($conn, $db, 2303, 'Domain does not exist', $clTRID, $trans);
|
sendEppError($conn, $db, 2303, 'Domain does not exist', $clTRID, $trans);
|
||||||
|
@ -70,6 +72,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$expiration_date = explode(" ", $domainData['exdate'])[0]; // remove time, keep only date
|
$expiration_date = explode(" ", $domainData['exdate'])[0]; // remove time, keep only date
|
||||||
|
|
||||||
|
@ -93,11 +96,13 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$after_10_years = $db->query("SELECT YEAR(DATE_ADD(CURDATE(),INTERVAL 10 YEAR))")->fetchColumn();
|
$after_10_years = $db->query("SELECT YEAR(DATE_ADD(CURDATE(),INTERVAL 10 YEAR))")->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
$stmt = $db->prepare("SELECT YEAR(DATE_ADD(:exdate, INTERVAL :date_add MONTH))");
|
$stmt = $db->prepare("SELECT YEAR(DATE_ADD(:exdate, INTERVAL :date_add MONTH))");
|
||||||
$stmt->bindParam(':exdate', $domainData['exdate'], PDO::PARAM_STR);
|
$stmt->bindParam(':exdate', $domainData['exdate'], PDO::PARAM_STR);
|
||||||
$stmt->bindParam(':date_add', $date_add, PDO::PARAM_INT);
|
$stmt->bindParam(':date_add', $date_add, PDO::PARAM_INT);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$after_renew = $stmt->fetchColumn();
|
$after_renew = $stmt->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
// Domains can be renewed at any time, but the expire date cannot be more than 10 years in the future.
|
// Domains can be renewed at any time, but the expire date cannot be more than 10 years in the future.
|
||||||
if ($after_renew > $after_10_years) {
|
if ($after_renew > $after_10_years) {
|
||||||
|
@ -110,6 +115,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
$stmt->bindParam(':registrarId', $clid['id'], PDO::PARAM_INT);
|
$stmt->bindParam(':registrarId', $clid['id'], PDO::PARAM_INT);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
$registrar_balance = $row['accountBalance'];
|
$registrar_balance = $row['accountBalance'];
|
||||||
$creditLimit = $row['creditLimit'];
|
$creditLimit = $row['creditLimit'];
|
||||||
$currency = $row['currency'];
|
$currency = $row['currency'];
|
||||||
|
@ -126,6 +132,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
$stmt->bindParam(':domain_id', $domainData['id'], PDO::PARAM_INT);
|
$stmt->bindParam(':domain_id', $domainData['id'], PDO::PARAM_INT);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$from = $stmt->fetchColumn();
|
$from = $stmt->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$rgpstatus = 'renewPeriod';
|
$rgpstatus = 'renewPeriod';
|
||||||
$stmt = $db->prepare("UPDATE domain SET exdate = DATE_ADD(exdate, INTERVAL :date_add MONTH), rgpstatus = :rgpstatus, renewPeriod = :renewPeriod, lastupdate = CURRENT_TIMESTAMP(3), upid = :upid, renewedDate = CURRENT_TIMESTAMP(3) WHERE id = :domain_id");
|
$stmt = $db->prepare("UPDATE domain SET exdate = DATE_ADD(exdate, INTERVAL :date_add MONTH), rgpstatus = :rgpstatus, renewPeriod = :renewPeriod, lastupdate = CURRENT_TIMESTAMP(3), upid = :upid, renewedDate = CURRENT_TIMESTAMP(3) WHERE id = :domain_id");
|
||||||
|
@ -162,6 +169,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
$stmt->bindParam(':domain_id', $domainData['id'], PDO::PARAM_INT);
|
$stmt->bindParam(':domain_id', $domainData['id'], PDO::PARAM_INT);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$to = $stmt->fetchColumn();
|
$to = $stmt->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
// Insert into statement:
|
// Insert into statement:
|
||||||
$stmt = $db->prepare("INSERT INTO statement (registrar_id, date, command, domain_name, length_in_months, fromS, toS, amount) VALUES (?, CURRENT_TIMESTAMP(3), ?, ?, ?, ?, ?, ?)");
|
$stmt = $db->prepare("INSERT INTO statement (registrar_id, date, command, domain_name, length_in_months, fromS, toS, amount) VALUES (?, CURRENT_TIMESTAMP(3), ?, ?, ?, ?, ?, ?)");
|
||||||
|
@ -174,11 +182,13 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
$stmt->bindParam(':name', $domainName, PDO::PARAM_STR);
|
$stmt->bindParam(':name', $domainName, PDO::PARAM_STR);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$exdateUpdated = $stmt->fetchColumn();
|
$exdateUpdated = $stmt->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
// Check for an existing entry in statistics for the current date
|
// Check for an existing entry in statistics for the current date
|
||||||
$stmt = $db->prepare("SELECT id FROM statistics WHERE date = CURDATE()");
|
$stmt = $db->prepare("SELECT id FROM statistics WHERE date = CURDATE()");
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$curdate_id = $stmt->fetchColumn();
|
$curdate_id = $stmt->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
// If there's no entry for the current date, insert one
|
// If there's no entry for the current date, insert one
|
||||||
if (!$curdate_id) {
|
if (!$curdate_id) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue