<?php

//config.php

$nameofdb = 'khyajijq_mdb';
$dbusername = 'khyajijq_mdb';
$dbpassword = 'biXV;Wx0-C%Y';
$dbprefix = 'mondialisa_';
$_SESSION['CONFIG']['DB_TABLES_PREFIX'] = $dbprefix;

$_SESSION['CONFIG']['APP_TITLE'] = 'mondialisa.com';

// Connect to MySQL via PDO
// Vérifie si la connexion n'existe pas déjà
if (!isset($dbh) || !($dbh instanceof PDO)) {

    // Connect to MySQL via PDO
    try {
        $dbh = new PDO(
            "mysql:host=localhost;dbname=$nameofdb;charset=utf8mb4",
            $dbusername,
            $dbpassword,
            [
                PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
                PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
                PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8mb4"
            ]
        );

        // Sécurité supplémentaire
        $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    } catch (PDOException $e) {
        catcherror($e, 'Erreur 718', 'info');
    }
}

?>
