Files
wow-registrace/includes/Database.php
T
vojta 2b9a673912 Initial commit: AzerothCore registration site
PHP registration page for AzerothCore with SRP6 salt/verifier generation,
Cloudflare Turnstile + honeypot + rate limiting anti-spam, and a WoW-themed
landing page with client setup instructions.
2026-08-05 11:41:24 +02:00

31 lines
814 B
PHP

<?php
declare(strict_types=1);
final class Database
{
private static ?PDO $connection = null;
public static function connection(): PDO
{
if (self::$connection === null) {
$config = require __DIR__ . '/config.php';
$db = $config['db'];
$dsn = sprintf(
'mysql:host=%s;port=%d;dbname=%s;charset=utf8mb4',
$db['host'],
$db['port'],
$db['database']
);
self::$connection = new PDO($dsn, $db['username'], $db['password'], [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
]);
}
return self::$connection;
}
}