Files
web_work/OLD_CODE/config/database.php
kirill.khorkov a7282f7363 Fix
2025-12-17 01:18:27 +03:00

32 lines
875 B
PHP

<?php
class Database {
private static $instance = null;
private $connection;
private function __construct() {
try {
$this->connection = new PDO(
"pgsql:host=185.130.224.177;port=5481;dbname=postgres",
"admin",
"38feaad2840ccfda0e71243a6faaecfd"
);
$this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->connection->exec("SET NAMES 'utf8'");
} catch(PDOException $e) {
die("Ошибка подключения: " . $e->getMessage());
}
}
public static function getInstance() {
if (self::$instance == null) {
self::$instance = new Database();
}
return self::$instance;
}
public function getConnection() {
return $this->connection;
}
}
?>