<?php
define('DB1_HOST', 'localhost:3306');
define('DB1_USER', 'gqdcvggs');
define('DB1_PASS', 'imators_onlyforcpanelmachineforallwebsite***#@&&*SECURITY');
define('DB1_NAME', 'gqdcvggs_imators-user');

define('DB2_HOST', 'localhost:3306');
define('DB2_USER', 'gqdcvggs');
define('DB2_PASS', 'imators_onlyforcpanelmachineforallwebsite***#@&&*SECURITY');
define('DB2_NAME', 'gqdcvggs_managements');

function getDB1Connection() {
    try {
        $db1 = new PDO(
            "mysql:host=" . DB1_HOST . ";dbname=" . DB1_NAME,
            DB1_USER,
            DB1_PASS,
            array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
        );
        return $db1;
    } catch(PDOException $e) {
        die("Erreur de connexion: " . $e->getMessage());
    }
}

function getDB2Connection() {
    try {
        $db2 = new PDO(
            "mysql:host=" . DB2_HOST . ";dbname=" . DB2_NAME,
            DB2_USER,
            DB2_PASS,
            array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
        );
        return $db2;
    } catch(PDOException $e) {
        die("Erreur de connexion: " . $e->getMessage());
    }
}