mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-16 09:37:00 +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]);
|
||||
|
||||
$results[$contactID] = $stmt->fetch() ? '0' : '1'; // 0 if exists, 1 if not
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
|
||||
$ids = [];
|
||||
|
@ -85,6 +86,7 @@ function processHostCheck($conn, $db, $xml, $trans) {
|
|||
$stmt->execute(['name' => $host]);
|
||||
|
||||
$results[$host] = $stmt->fetch() ? '0' : '1'; // 0 if exists, 1 if not
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
|
||||
$names = [];
|
||||
|
@ -157,6 +159,7 @@ function processDomainCheck($conn, $db, $xml, $trans, $clid) {
|
|||
$stmt->bindParam(':domainName', $label, PDO::PARAM_STR);
|
||||
$stmt->execute();
|
||||
$claim_key = $stmt->fetchColumn();
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ($claim_key) {
|
||||
$domainEntry[] = 1;
|
||||
|
@ -200,6 +203,7 @@ function processDomainCheck($conn, $db, $xml, $trans, $clid) {
|
|||
$stmt->bindParam(':phase', $launchPhaseName, PDO::PARAM_STR);
|
||||
$stmt->execute();
|
||||
$taken = $stmt->fetchColumn();
|
||||
$stmt->closeCursor();
|
||||
$availability = $taken ? '0' : '1';
|
||||
|
||||
// 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->execute();
|
||||
$reserved = $stmt->fetchColumn();
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ($reserved) {
|
||||
$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->execute();
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ($result) {
|
||||
if ($result['type'] === 'taken') {
|
||||
|
@ -293,6 +299,7 @@ function processDomainCheck($conn, $db, $xml, $trans, $clid) {
|
|||
$stmt->bindParam(':token', $allocationTokenValue, PDO::PARAM_STR);
|
||||
$stmt->execute();
|
||||
$token = $stmt->fetchColumn();
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ($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->execute();
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ($result != false) {
|
||||
$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->execute();
|
||||
$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->bindParam(':domainName', $domainName, PDO::PARAM_STR);
|
||||
$stmt->execute();
|
||||
$domainData = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
if (!$domainData) {
|
||||
sendEppError($conn, $db, 2303, 'Domain does not exist', $clTRID, $trans);
|
||||
|
@ -70,6 +72,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
$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();
|
||||
$stmt->closeCursor();
|
||||
$stmt = $db->prepare("SELECT YEAR(DATE_ADD(:exdate, INTERVAL :date_add MONTH))");
|
||||
$stmt->bindParam(':exdate', $domainData['exdate'], PDO::PARAM_STR);
|
||||
$stmt->bindParam(':date_add', $date_add, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$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.
|
||||
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->execute();
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
$registrar_balance = $row['accountBalance'];
|
||||
$creditLimit = $row['creditLimit'];
|
||||
$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->execute();
|
||||
$from = $stmt->fetchColumn();
|
||||
$stmt->closeCursor();
|
||||
|
||||
$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");
|
||||
|
@ -162,6 +169,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
$stmt->bindParam(':domain_id', $domainData['id'], PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$to = $stmt->fetchColumn();
|
||||
$stmt->closeCursor();
|
||||
|
||||
// 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), ?, ?, ?, ?, ?, ?)");
|
||||
|
@ -174,11 +182,13 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
$stmt->bindParam(':name', $domainName, PDO::PARAM_STR);
|
||||
$stmt->execute();
|
||||
$exdateUpdated = $stmt->fetchColumn();
|
||||
$stmt->closeCursor();
|
||||
|
||||
// Check for an existing entry in statistics for the current date
|
||||
$stmt = $db->prepare("SELECT id FROM statistics WHERE date = CURDATE()");
|
||||
$stmt->execute();
|
||||
$curdate_id = $stmt->fetchColumn();
|
||||
$stmt->closeCursor();
|
||||
|
||||
// If there's no entry for the current date, insert one
|
||||
if (!$curdate_id) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue