mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-15 17:16:59 +02:00
Further transaction log improvements
This commit is contained in:
parent
9c97f3077a
commit
266a3386ac
2 changed files with 74 additions and 13 deletions
|
@ -258,3 +258,13 @@ function updateTransaction($db, $cmd, $obj_type, $obj_id, $code, $msg, $svTRID,
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getClid(PDO $db, string $clid): ?int {
|
||||||
|
$stmt = $db->prepare("SELECT id FROM registrar WHERE clid = :clid LIMIT 1");
|
||||||
|
$stmt->bindParam(':clid', $clid, PDO::PARAM_STR);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
return $result ? (int)$result['id'] : null;
|
||||||
|
}
|
|
@ -91,11 +91,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
$clID = (string) $xml->command->login->clID;
|
$clID = (string) $xml->command->login->clID;
|
||||||
$pw = (string) $xml->command->login->pw;
|
$pw = (string) $xml->command->login->pw;
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
$stmt = $db->prepare("SELECT id FROM registrar WHERE clid = :clid LIMIT 1");
|
$clid = getClid($db, $clID);
|
||||||
$stmt->bindParam(':clid', $clID, PDO::PARAM_STR);
|
|
||||||
$stmt->execute();
|
|
||||||
$clid = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
||||||
$clid = $clid['id'];
|
|
||||||
$xmlString = $xml->asXML();
|
$xmlString = $xml->asXML();
|
||||||
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
|
|
||||||
|
@ -106,14 +102,13 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
'command' => 'login',
|
'command' => 'login',
|
||||||
'resultCode' => 1000,
|
'resultCode' => 1000,
|
||||||
'lang' => 'en-US',
|
'lang' => 'en-US',
|
||||||
'message' => 'Login successful',
|
|
||||||
'clTRID' => $clTRID,
|
'clTRID' => $clTRID,
|
||||||
'svTRID' => $svTRID,
|
'svTRID' => $svTRID,
|
||||||
];
|
];
|
||||||
|
|
||||||
$epp = new EPP\EppWriter();
|
$epp = new EPP\EppWriter();
|
||||||
$xml = $epp->epp_writer($response);
|
$xml = $epp->epp_writer($response);
|
||||||
updateTransaction($db, 'login', null, null, 1000, 'Login successful', $svTRID, $xml, $trans);
|
updateTransaction($db, 'login', null, null, 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
||||||
sendEppResponse($conn, $xml);
|
sendEppResponse($conn, $xml);
|
||||||
} else {
|
} else {
|
||||||
sendEppError($conn, 2200, 'Authentication error', $clTRID);
|
sendEppError($conn, 2200, 'Authentication error', $clTRID);
|
||||||
|
@ -124,11 +119,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
case isset($xml->command->logout):
|
case isset($xml->command->logout):
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$stmt = $db->prepare("SELECT id FROM registrar WHERE clid = :clid LIMIT 1");
|
$clid = getClid($db, $clID);
|
||||||
$stmt->bindParam(':clid', $data['clid'], PDO::PARAM_STR);
|
|
||||||
$stmt->execute();
|
|
||||||
$clid = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
||||||
$clid = $clid['id'];
|
|
||||||
$table->del($connId);
|
$table->del($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
$xmlString = $xml->asXML();
|
$xmlString = $xml->asXML();
|
||||||
|
@ -144,7 +135,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
|
|
||||||
$epp = new EPP\EppWriter();
|
$epp = new EPP\EppWriter();
|
||||||
$xml = $epp->epp_writer($response);
|
$xml = $epp->epp_writer($response);
|
||||||
updateTransaction($db, 'logout', null, null, 1500, 'Logout successful', $svTRID, $xml, $trans);
|
updateTransaction($db, 'logout', null, null, 1500, 'Command completed successfully; ending session', $svTRID, $xml, $trans);
|
||||||
sendEppResponse($conn, $xml);
|
sendEppResponse($conn, $xml);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
break;
|
break;
|
||||||
|
@ -160,6 +151,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -172,6 +166,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -184,6 +181,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -196,6 +196,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -208,6 +211,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -220,6 +226,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -232,6 +241,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -244,6 +256,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -256,6 +271,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -268,6 +286,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -280,6 +301,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -292,6 +316,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -304,6 +331,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -316,6 +346,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -328,6 +361,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -340,6 +376,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -352,6 +391,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -364,6 +406,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -376,6 +421,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
@ -388,6 +436,9 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
|
||||||
{
|
{
|
||||||
$data = $table->get($connId);
|
$data = $table->get($connId);
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
$clid = getClid($db, $data['clid']);
|
||||||
|
$xmlString = $xml->asXML();
|
||||||
|
$trans = createTransaction($db, $clid, $clTRID, $xmlString);
|
||||||
if (!$data || $data['logged_in'] !== 1) {
|
if (!$data || $data['logged_in'] !== 1) {
|
||||||
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
sendEppError($conn, 2202, 'Authorization error', $clTRID);
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue