mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-15 09:07:00 +02:00
Fixed potential whois/rdap db issue and some cleanup
This commit is contained in:
parent
8966edf046
commit
76ec107f71
3 changed files with 30 additions and 29 deletions
|
@ -8,7 +8,7 @@ return [
|
||||||
'db_database' => 'your_database_name',
|
'db_database' => 'your_database_name',
|
||||||
'db_username' => 'your_username',
|
'db_username' => 'your_username',
|
||||||
'db_password' => 'your_password',
|
'db_password' => 'your_password',
|
||||||
|
|
||||||
// Escrow Configuration
|
// Escrow Configuration
|
||||||
'escrow_deposit_path' => '/opt/escrow',
|
'escrow_deposit_path' => '/opt/escrow',
|
||||||
'escrow_deleteXML' => false,
|
'escrow_deleteXML' => false,
|
||||||
|
@ -22,12 +22,12 @@ return [
|
||||||
'escrow_report_url' => 'https://ry-api.icann.org/report/',
|
'escrow_report_url' => 'https://ry-api.icann.org/report/',
|
||||||
'escrow_report_username' => 'your_username',
|
'escrow_report_username' => 'your_username',
|
||||||
'escrow_report_password' => 'your_password',
|
'escrow_report_password' => 'your_password',
|
||||||
|
|
||||||
// Reporting Configuration
|
// Reporting Configuration
|
||||||
'reporting_upload' => false,
|
'reporting_upload' => false,
|
||||||
'reporting_username' => 'your_username',
|
'reporting_username' => 'your_username',
|
||||||
'reporting_password' => 'your_password',
|
'reporting_password' => 'your_password',
|
||||||
|
|
||||||
// Zone Writer Configuration
|
// Zone Writer Configuration
|
||||||
'dns_server' => 'bind',
|
'dns_server' => 'bind',
|
||||||
];
|
];
|
|
@ -51,18 +51,19 @@ $http->set([
|
||||||
'http_compression' => true
|
'http_compression' => true
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// Connect to the database
|
||||||
|
try {
|
||||||
|
$c = require_once 'config.php';
|
||||||
|
$pdo = new PDO("{$c['db_type']}:host={$c['db_host']};dbname={$c['db_database']}", $c['db_username'], $c['db_password']);
|
||||||
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$response->header('Content-Type', 'application/json');
|
||||||
|
$response->end(json_encode(['error' => 'Error connecting to database']));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Register a callback to handle incoming requests
|
// Register a callback to handle incoming requests
|
||||||
$http->on('request', function ($request, $response) {
|
$http->on('request', function ($request, $response) use ($c, $pdo) {
|
||||||
// Connect to the database
|
|
||||||
try {
|
|
||||||
$c = require_once 'config.php';
|
|
||||||
$pdo = new PDO("{$c['db_type']}:host={$c['db_host']};dbname={$c['db_database']}", $c['db_username'], $c['db_password']);
|
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
$response->header('Content-Type', 'application/json');
|
|
||||||
$response->end(json_encode(['error' => 'Error connecting to database']));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract the request path
|
// Extract the request path
|
||||||
$requestPath = $request->server['request_uri'];
|
$requestPath = $request->server['request_uri'];
|
||||||
|
|
|
@ -25,23 +25,23 @@ $server->set([
|
||||||
'package_eof' => "\r\n"
|
'package_eof' => "\r\n"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// Connect to the database
|
||||||
|
try {
|
||||||
|
$c = require_once 'config.php';
|
||||||
|
$pdo = new PDO("{$c['db_type']}:host={$c['db_host']};dbname={$c['db_database']}", $c['db_username'], $c['db_password']);
|
||||||
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$server->send($fd, "Error connecting to database");
|
||||||
|
$server->close($fd);
|
||||||
|
}
|
||||||
|
|
||||||
// Register a callback to handle incoming connections
|
// Register a callback to handle incoming connections
|
||||||
$server->on('connect', function ($server, $fd) {
|
$server->on('connect', function ($server, $fd) {
|
||||||
echo "Client connected: {$fd}\r\n";
|
echo "Client connected: {$fd}\r\n";
|
||||||
});
|
});
|
||||||
|
|
||||||
// Register a callback to handle incoming requests
|
// Register a callback to handle incoming requests
|
||||||
$server->on('receive', function ($server, $fd, $reactorId, $data) {
|
$server->on('receive', function ($server, $fd, $reactorId, $data) use ($c, $pdo) {
|
||||||
// Connect to the database
|
|
||||||
try {
|
|
||||||
$c = require_once 'config.php';
|
|
||||||
$pdo = new PDO("{$c['db_type']}:host={$c['db_host']};dbname={$c['db_database']}", $c['db_username'], $c['db_password']);
|
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
$server->send($fd, "Error connecting to database");
|
|
||||||
$server->close($fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
$privacy = $c['privacy'];
|
$privacy = $c['privacy'];
|
||||||
|
|
||||||
// Validate and sanitize the data
|
// Validate and sanitize the data
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue