<?php
// Copy this file to config.php and fill in your local values.
// config.php is gitignored — never commit real credentials.

define('DB_HOST', 'localhost');
define('DB_NAME', 'cwsn_portal');
define('DB_USER', 'root');
define('DB_PASS', '');

// Every login (Admin or CLRC) is stored with this suffix-free login_id in
// the users table — 'admin' for the district Admin, or a CLRC code.
define('SITE_NAME', 'CWSN Portal — SSM Purba Bardhaman');

function getPDO(): PDO {
    static $pdo = null;
    if ($pdo === null) {
        $dsn = 'mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=utf8mb4';
        $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;
}
