Fixed potential whois/rdap db issue and some cleanup

This commit is contained in:
Pinga 2023-11-02 12:46:55 +02:00
parent 8966edf046
commit 76ec107f71
3 changed files with 30 additions and 29 deletions

View file

@ -51,8 +51,6 @@ $http->set([
'http_compression' => true 'http_compression' => true
]); ]);
// Register a callback to handle incoming requests
$http->on('request', function ($request, $response) {
// Connect to the database // Connect to the database
try { try {
$c = require_once 'config.php'; $c = require_once 'config.php';
@ -64,6 +62,9 @@ $http->on('request', function ($request, $response) {
return; return;
} }
// Register a callback to handle incoming requests
$http->on('request', function ($request, $response) use ($c, $pdo) {
// Extract the request path // Extract the request path
$requestPath = $request->server['request_uri']; $requestPath = $request->server['request_uri'];

View file

@ -25,13 +25,6 @@ $server->set([
'package_eof' => "\r\n" 'package_eof' => "\r\n"
]); ]);
// Register a callback to handle incoming connections
$server->on('connect', function ($server, $fd) {
echo "Client connected: {$fd}\r\n";
});
// Register a callback to handle incoming requests
$server->on('receive', function ($server, $fd, $reactorId, $data) {
// Connect to the database // Connect to the database
try { try {
$c = require_once 'config.php'; $c = require_once 'config.php';
@ -42,6 +35,13 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
$server->close($fd); $server->close($fd);
} }
// Register a callback to handle incoming connections
$server->on('connect', function ($server, $fd) {
echo "Client connected: {$fd}\r\n";
});
// Register a callback to handle incoming requests
$server->on('receive', function ($server, $fd, $reactorId, $data) use ($c, $pdo) {
$privacy = $c['privacy']; $privacy = $c['privacy'];
// Validate and sanitize the data // Validate and sanitize the data