<?php
echo "<!DOCTYPE html>";
echo "<html>";
echo "<head>";
echo "<title>Test PHP</title>";
echo "<style>";
echo "body { font-family: Arial, sans-serif; margin: 40px; background: #f0f0f0; }";
echo ".success { color: green; font-size: 24px; font-weight: bold; }";
echo ".info { color: #333; margin: 20px 0; padding: 15px; background: white; border-radius: 8px; }";
echo ".btn { background: #FF5722; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px; display: inline-block; margin: 5px; }";
echo ".btn:hover { background: #E64A19; }";
echo "</style>";
echo "</head>";
echo "<body>";

echo "<h1 class='success'>🎉 PHP Berfungsi dengan Baik!</h1>";

echo "<div class='info'>";
echo "<h2>✅ Status Server:</h2>";
echo "<ul>";
echo "<li>✅ PHP Version: " . phpversion() . "</li>";
echo "<li>✅ Server: " . $_SERVER['SERVER_SOFTWARE'] . "</li>";
echo "<li>✅ Document Root: " . $_SERVER['DOCUMENT_ROOT'] . "</li>";
echo "<li>✅ Current Time: " . date('Y-m-d H:i:s') . "</li>";
echo "</ul>";
echo "</div>";

echo "<div class='info'>";
echo "<h2>🔗 Link untuk Test:</h2>";
echo "<a href='/simple.html' class='btn'>Halaman HTML Sederhana</a>";
echo "<a href='/test' class='btn'>Laravel Route Test</a>";
echo "<a href='/test-anggota' class='btn'>Data Anggota Laravel</a>";
echo "</div>";

echo "<div class='info'>";
echo "<h2>📊 Database Test:</h2>";
try {
    $pdo = new PDO('mysql:host=127.0.0.1;dbname=si_anggota_pks', 'root', '');
    $stmt = $pdo->query('SELECT COUNT(*) as total FROM tbl_anggota');
    $result = $stmt->fetch();
    echo "<p>✅ Database terhubung! Total anggota: " . $result['total'] . "</p>";
} catch (Exception $e) {
    echo "<p>❌ Database error: " . $e->getMessage() . "</p>";
}
echo "</div>";

echo "<script>";
echo "console.log('✅ PHP test page loaded!');";
echo "console.log('Timestamp:', new Date().toLocaleString());";
echo "</script>";

echo "</body>";
echo "</html>";
?>


