<?php
// install_database.php - Run this file to setup database
$host = 'localhost';
$username = 'ntsazwmq_bmyaaa';
$password = '@Anupsinha@321';

try {
    $pdo = new PDO("mysql:host=$host", $username, $password);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    
    // Read SQL file
    $sql = file_get_contents('bmyo_database.sql');
    
    // Execute SQL
    $pdo->exec($sql);
    
    echo "<h2 style='color: green;'>✅ Database created successfully!</h2>";
    echo "<p>Database Name: <strong>$dbname</strong></p>";
    echo "<p>Admin Email: <strong>admin@bmyouth.org</strong></p>";
    echo "<p>Admin Password: <strong>Admin@123</strong></p>";
    echo "<a href='index.php'>Go to Homepage</a> | ";
    echo "<a href='admin/login.php'>Go to Admin Panel</a>";
    
} catch (PDOException $e) {
    echo "<h2 style='color: red;'>Error: " . $e->getMessage() . "</h2>";
}
?>