<?php
// Database connection settings
$host = 'localhost';
$db   = 'shemacli_database';
$user = 'shemacli_user';
$pass = 'Onefamily123!';
$charset = 'utf8mb4';

$dsn = "mysql:host=$host;dbname=$db;charset=$charset";

$options = [
    PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
    PDO::ATTR_EMULATE_PREPARES   => false,
];

try {
    $pdo = new PDO($dsn, $user, $pass, $options);

    // Set PHP timezone
    date_default_timezone_set('Africa/Kigali');

    // Set MySQL session timezone
    $pdo->exec("SET time_zone = '+02:00'");
} catch (PDOException $e) {
    // NEVER echo anything here
    error_log($e->getMessage());
    die("Database connection error.");
}
