PgSQL updates in other components

This commit is contained in:
Pinga 2023-08-15 13:08:43 +03:00
parent ba05bd618c
commit 274760f2c5
7 changed files with 36 additions and 13 deletions

View file

@ -34,7 +34,8 @@ $server->on('connect', function ($server, $fd) {
$server->on('receive', function ($server, $fd, $reactorId, $data) {
// Connect to the database
try {
$pdo = new PDO('mysql:host=localhost;dbname=registry', 'registry-select', 'EPPRegistrySELECT');
$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");