<?php
// Copy this file to config.php and fill in your Hostinger MySQL credentials.
// Never commit config.php to version control.

define('DB_HOST', 'localhost');
define('DB_NAME', 'u595523489_wndd');   // e.g. u123456789_winded
define('DB_USER', 'u595523489_wnddusr');   // e.g. u123456789_winded
define('DB_PASS', '@>fnr0E7eS');
define('DB_CHARSET', 'utf8mb4');

function db(): PDO {
    static $pdo = null;
    if ($pdo === null) {
        $dsn = 'mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=' . DB_CHARSET;
        $pdo = new PDO($dsn, DB_USER, DB_PASS, [
            PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
            PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
            PDO::ATTR_EMULATE_PREPARES   => false,
        ]);
    }
    return $pdo;
}
