<?php
// Database configuration
define('DB_HOST', 'localhost');
define('DB_NAME', 'gp_crackers');
define('DB_USER', 'root');
define('DB_PASS', '');

try {
    // Try to connect with the database name
    $pdo = new PDO("mysql:host=" . DB_HOST . ";dbname=" . DB_NAME . ";charset=utf8", DB_USER, DB_PASS);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
} catch (PDOException $e) {
    // If database doesn't exist, try connecting to the server alone
    try {
        $pdo = new PDO("mysql:host=" . DB_HOST . ";charset=utf8", DB_USER, DB_PASS);
        $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    } catch (PDOException $e2) {
        die("Connection failed: " . $e2->getMessage());
    }
}

// SMTP Configuration (for Gmail)
define('SMTP_HOST', 'smtp.gmail.com');
define('SMTP_USER', 'your-email@gmail.com');      // Update this
define('SMTP_PASS', 'your-app-password');         // Update this
define('SMTP_PORT', 587);
define('SMTP_RECIPIENT', 'santhoshkumardkv18@gmail.com');
?>
