<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

if (session_status() === PHP_SESSION_NONE) {
    session_start();
}

// Docker environment variables with fallbacks for local development
$host_name = $_ENV['DB_HOST'] ?? 'localhost';
$database = $_ENV['DB_NAME'] ?? 'rezepte_klaus';
$user_name = $_ENV['DB_USER'] ?? 'root';
$password = $_ENV['DB_PASS'] ?? '';

$link = new mysqli($host_name, $user_name, $password, $database);

if ($link->connect_error) {
    die('<p>Verbindung zum MySQL Server fehlgeschlagen: '. $link->connect_error .'</p>');
}
?>