<?php

require_once __DIR__ . '/vendor/autoload.php';

use Dotenv\Dotenv;

// Lade die `.env`-Datei
$dotenv = Dotenv::createImmutable(__DIR__ . '/../secrets');
$dotenv->load();

// Auf Variablen zugreifen
$db_host = $_ENV['DB_HOST'];
$db_user = $_ENV['DB_USER'];
$db_pass = $_ENV['DB_PASS'];
$db_name = $_ENV['DB_NAME'];

// Test: Variablen ausgeben
echo "Host: $db_host, User: $db_user";

// Existing database connection code
$mysqli = new mysqli($db_host, $db_user, $db_pass, $db_name);

if ($mysqli->connect_error) {
    die("Connection failed: " . $mysqli->connect_error);
}
echo "Connected successfully to Google Cloud SQL!";
?>