<?php
session_start();
include __DIR__ . '/../includes/header.php';
include __DIR__ . '/../includes/nav.php';

// === CONFIG === //
$dbHost = 'localhost';
$dbUser = 'kd54698_cloud';
$dbPass = 'w3r24asd!!!';
$dbName = 'kd54698_cloud';
// ============== //

// --- SQL-Status ---
$sql_ok = false;
$sql_msg = '';
$conn = @new mysqli($dbHost, $dbUser, $dbPass, $dbName);
if ($conn->connect_error) {
    $sql_msg = 'Fehler: ' . $conn->connect_error;
} else {
    $sql_ok = true;
    $sql_msg = 'Verbindung erfolgreich.';
}
$conn->close();

// --- Allgemeines ---
$phpVersion = phpversion();
$memory = ini_get('memory_limit');
$serverTime = date('Y-m-d H:i:s');
?>

<div class="container mt-5">
    <h1 class="mb-4">🩺 Systemstatus</h1>

    <table class="table table-bordered w-100">
        <tr>
            <th>MySQL</th>
            <td class="<?= $sql_ok ? 'table-success' : 'table-danger' ?>">
                <?= $sql_ok ? '✅ ' : '❌ ' ?> <?= $sql_msg ?>
            </td>
        </tr>
        <tr>
            <th>PHP-Version</th>
            <td><?= $phpVersion ?></td>
        </tr>
        <tr>
            <th>Speicherlimit</th>
            <td><?= $memory ?></td>
        </tr>
        <tr>
            <th>Server-Zeit</th>
            <td><?= $serverTime ?></td>
        </tr>
    </table>
</div>

<?php include __DIR__ . '/../includes/footer.php'; ?>
