mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-07 19:43:21 +02:00
EPP server attempt to fix a MySQL error
This commit is contained in:
parent
994b82ce20
commit
6b53150a19
3 changed files with 12 additions and 11 deletions
|
@ -145,10 +145,10 @@ fi
|
||||||
# Determine PHP configuration files based on OS and version
|
# Determine PHP configuration files based on OS and version
|
||||||
if [[ "$OS" == "Ubuntu" && "$VER" == "24.04" ]]; then
|
if [[ "$OS" == "Ubuntu" && "$VER" == "24.04" ]]; then
|
||||||
phpIniFpm='/etc/php/8.3/fpm/php.ini'
|
phpIniFpm='/etc/php/8.3/fpm/php.ini'
|
||||||
PHP_VERSION="php8.3"
|
PHP_VERSION="php8.3"
|
||||||
else
|
else
|
||||||
phpIniFpm='/etc/php/8.2/fpm/php.ini'
|
phpIniFpm='/etc/php/8.2/fpm/php.ini'
|
||||||
PHP_VERSION="php8.2"
|
PHP_VERSION="php8.2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update php.ini files
|
# Update php.ini files
|
||||||
|
|
|
@ -5,13 +5,7 @@ function processPoll($conn, $db, $xml, $clid, $trans) {
|
||||||
$node = $xml->command->poll;
|
$node = $xml->command->poll;
|
||||||
$op = (string) $node->attributes()->op;
|
$op = (string) $node->attributes()->op;
|
||||||
$response = [];
|
$response = [];
|
||||||
|
$clid = getClid($db, $clid);
|
||||||
$stmt = $db->prepare("SELECT id FROM registrar WHERE clid = :clid LIMIT 1");
|
|
||||||
$stmt->bindParam(':clid', $clid, PDO::PARAM_STR);
|
|
||||||
$stmt->execute();
|
|
||||||
$clid = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
||||||
$clid = $clid['id'];
|
|
||||||
|
|
||||||
$next_msg_id = null;
|
$next_msg_id = null;
|
||||||
|
|
||||||
if ($op === 'ack') {
|
if ($op === 'ack') {
|
||||||
|
@ -19,6 +13,7 @@ function processPoll($conn, $db, $xml, $clid, $trans) {
|
||||||
$stmt = $db->prepare("SELECT id FROM poll WHERE registrar_id = :registrar_id AND id = :id LIMIT 1");
|
$stmt = $db->prepare("SELECT id FROM poll WHERE registrar_id = :registrar_id AND id = :id LIMIT 1");
|
||||||
$stmt->execute([':registrar_id' => $clid, ':id' => $id]);
|
$stmt->execute([':registrar_id' => $clid, ':id' => $id]);
|
||||||
$ack_id = $stmt->fetchColumn();
|
$ack_id = $stmt->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if (!$ack_id) {
|
if (!$ack_id) {
|
||||||
$response['resultCode'] = 2303; // Object does not exist
|
$response['resultCode'] = 2303; // Object does not exist
|
||||||
|
@ -31,12 +26,14 @@ function processPoll($conn, $db, $xml, $clid, $trans) {
|
||||||
$stmt = $db->prepare("SELECT id FROM poll WHERE registrar_id = :registrar_id ORDER BY id ASC LIMIT 1");
|
$stmt = $db->prepare("SELECT id FROM poll WHERE registrar_id = :registrar_id ORDER BY id ASC LIMIT 1");
|
||||||
$stmt->execute([':registrar_id' => $clid]);
|
$stmt->execute([':registrar_id' => $clid]);
|
||||||
$next_msg_id = $stmt->fetchColumn();
|
$next_msg_id = $stmt->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if ($next_msg_id) {
|
if ($next_msg_id) {
|
||||||
// Messages remain, return 1000 with next message ID
|
// Messages remain, return 1000 with next message ID
|
||||||
$stmt = $db->prepare("SELECT COUNT(*) FROM poll WHERE registrar_id = :registrar_id");
|
$stmt = $db->prepare("SELECT COUNT(*) FROM poll WHERE registrar_id = :registrar_id");
|
||||||
$stmt->execute([':registrar_id' => $clid]);
|
$stmt->execute([':registrar_id' => $clid]);
|
||||||
$remaining = $stmt->fetchColumn();
|
$remaining = $stmt->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$response['resultCode'] = 1000; // Command completed successfully
|
$response['resultCode'] = 1000; // Command completed successfully
|
||||||
} else {
|
} else {
|
||||||
|
@ -49,6 +46,7 @@ function processPoll($conn, $db, $xml, $clid, $trans) {
|
||||||
$stmt = $db->prepare("SELECT id, qdate, msg, msg_type, obj_name_or_id, obj_trStatus, obj_reID, obj_reDate, obj_acID, obj_acDate, obj_exDate, registrarName, creditLimit, creditThreshold, creditThresholdType, availableCredit FROM poll WHERE registrar_id = :registrar_id ORDER BY id ASC LIMIT 1");
|
$stmt = $db->prepare("SELECT id, qdate, msg, msg_type, obj_name_or_id, obj_trStatus, obj_reID, obj_reDate, obj_acID, obj_acDate, obj_exDate, registrarName, creditLimit, creditThreshold, creditThresholdType, availableCredit FROM poll WHERE registrar_id = :registrar_id ORDER BY id ASC LIMIT 1");
|
||||||
$stmt->execute([':registrar_id' => $clid]);
|
$stmt->execute([':registrar_id' => $clid]);
|
||||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$id = $result['id'] ?? null;
|
$id = $result['id'] ?? null;
|
||||||
$response['resultCode'] = $id ? 1301 : 1300;
|
$response['resultCode'] = $id ? 1301 : 1300;
|
||||||
|
@ -57,6 +55,7 @@ function processPoll($conn, $db, $xml, $clid, $trans) {
|
||||||
$stmt = $db->prepare("SELECT COUNT(id) AS counter FROM poll WHERE registrar_id = :registrar_id");
|
$stmt = $db->prepare("SELECT COUNT(id) AS counter FROM poll WHERE registrar_id = :registrar_id");
|
||||||
$stmt->execute([':registrar_id' => $clid]);
|
$stmt->execute([':registrar_id' => $clid]);
|
||||||
$counter = $stmt->fetchColumn();
|
$counter = $stmt->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$response['command'] = 'poll';
|
$response['command'] = 'poll';
|
||||||
$response['count'] = $counter;
|
$response['count'] = $counter;
|
||||||
|
|
|
@ -94,6 +94,7 @@ function checkLogin($db, $clID, $pw) {
|
||||||
$stmt = $db->prepare("SELECT pw FROM registrar WHERE clid = :username");
|
$stmt = $db->prepare("SELECT pw FROM registrar WHERE clid = :username");
|
||||||
$stmt->execute(['username' => $clID]);
|
$stmt->execute(['username' => $clID]);
|
||||||
$hashedPassword = $stmt->fetchColumn();
|
$hashedPassword = $stmt->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
return password_verify($pw, $hashedPassword);
|
return password_verify($pw, $hashedPassword);
|
||||||
}
|
}
|
||||||
|
@ -535,6 +536,7 @@ function getClid(Swoole\Database\PDOProxy $db, string $clid): ?int {
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
return $result ? (int)$result['id'] : null;
|
return $result ? (int)$result['id'] : null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue