<?php
header('Content-Type: application/json; charset=utf-8');

// Test de connexion aux deux bases
$results = array();

// Test 1: Base GGR
$conn1 = new mysqli('127.0.0.1', 'transubd_transub_user', 'Tr@nsub2@24', 'transubd_GGR');
if ($conn1->connect_error) {
    $results['ggr'] = array(
        'success' => false,
        'error' => $conn1->connect_error
    );
} else {
    $results['ggr'] = array('success' => true, 'message' => 'Connexion GGR OK');
    $conn1->close();
}

// Test 2: Base PointageBus
$conn2 = new mysqli('127.0.0.1', 'transubd_transub_user', 'Tr@nsub2@24', 'transubd_PointageBus');
if ($conn2->connect_error) {
    $results['pointage'] = array(
        'success' => false,
        'error' => $conn2->connect_error
    );
} else {
    $results['pointage'] = array('success' => true, 'message' => 'Connexion PointageBus OK');
    $conn2->close();
}

echo json_encode(array(
    'success' => true,
    'data' => $results,
    'message' => 'Test de connexion terminé'
));
?>