<?php
// ==================================================
// EMAIL SENDER WITH SMTP - REAL TIME & DATE
// ==================================================

// Set timezone ke Indonesia (WIB)
date_default_timezone_set('Asia/Jakarta');

// Check if PHPMailer exists
$phpmailer_available = file_exists('phpmailer/src/PHPMailer.php');

if ($phpmailer_available) {
    require_once 'phpmailer/src/PHPMailer.php';
    require_once 'phpmailer/src/SMTP.php';
    require_once 'phpmailer/src/Exception.php';
}

// Fungsi untuk generate waktu dan tanggal REAL-TIME
function generateRealTimeDate() {
    return date('h:i A - D, d M Y'); // Format: 07:38 AM - Mon, 10 Nov 2025
}

// Fungsi untuk membaca credentials dari file smtp.txt
function readSMTPCredentials() {
    $smtp_file = 'smtp.txt';
    
    if (!file_exists($smtp_file)) {
        return [
            'status' => 'error',
            'message' => 'File smtp.txt tidak ditemukan!'
        ];
    }
    
    $content = file_get_contents($smtp_file);
    $content = trim($content);
    
    if (empty($content)) {
        return [
            'status' => 'error',
            'message' => 'File smtp.txt kosong!'
        ];
    }
    
    if (strpos($content, ':') === false) {
        return [
            'status' => 'error', 
            'message' => 'Format salah! Gunakan: email:password'
        ];
    }
    
    list($email, $password) = explode(':', $content, 2);
    $email = trim($email);
    $password = trim($password);
    
    if (empty($email) || empty($password)) {
        return [
            'status' => 'error',
            'message' => 'Email atau password kosong!'
        ];
    }
    
    return [
        'status' => 'success',
        'email' => $email,
        'password' => $password
    ];
}

// Fungsi utama untuk mengirim email
function sendEmailWithSMTP($config) {
    $creds = readSMTPCredentials();
    if ($creds['status'] === 'error') {
        return $creds;
    }
    
    // Gunakan PHPMailer jika tersedia
    if (file_exists('phpmailer/src/PHPMailer.php')) {
        return sendWithPHPMailer($config, $creds);
    } else {
        return [
            'status' => 'error',
            'message' => 'PHPMailer tidak ditemukan! Download PHPMailer terlebih dahulu.'
        ];
    }
}

// Menggunakan PHPMailer untuk SMTP
function sendWithPHPMailer($config, $creds) {
    try {
        $mail = new PHPMailer\PHPMailer\PHPMailer(true);
        
        // Server settings
        $mail->isSMTP();
        $mail->Host = 'smtp.gmail.com';
        $mail->SMTPAuth = true;
        $mail->Username = $creds['email'];
        $mail->Password = $creds['password'];
        $mail->SMTPSecure = PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_STARTTLS;
        $mail->Port = 587;
        
        // Enable verbose debug output
        $mail->SMTPDebug = 0;
        
        // Recipients
        $mail->setFrom($creds['email'], $config['sender_name']);
        $mail->addAddress($config['target_email']);
        $mail->addReplyTo($config['sender_email'], $config['sender_name']);
        
        // Content - PASTIKAN waktu di-generate saat email dikirim
        $mail->isHTML(true);
        $mail->Subject = $config['subject'];
        
        // Generate body dengan waktu REAL-TIME saat email dikirim
        $real_time_date = generateRealTimeDate();
        $mail->Body = generateEmailBody($config, $real_time_date);
        
        // Add custom headers safely
        addCustomHeaders($mail, $config);
        
        $mail->send();
        
        return [
            'status' => 'success', 
            'message' => 'Email berhasil dikirim via SMTP Gmail!',
            'method' => 'PHPMailer + SMTP',
            'smtp_account' => $creds['email'],
            'time_sent' => $real_time_date
        ];
        
    } catch (Exception $e) {
        return [
            'status' => 'error', 
            'message' => 'SMTP Error: ' . $e->getMessage(),
            'method' => 'PHPMailer'
        ];
    }
}

// Add custom headers safely
function addCustomHeaders($mail, $config) {
    $headers = generateEmailHeaders($config);
    $headers_array = explode("\n", $headers);
    
    foreach ($headers_array as $header) {
        $header = trim($header);
        if (!empty($header)) {
            if (stripos($header, 'To:') === 0 || 
                stripos($header, 'From:') === 0 ||
                stripos($header, 'Subject:') === 0 ||
                stripos($header, 'Reply-To:') === 0 ||
                stripos($header, 'Date:') === 0 ||
                stripos($header, 'MIME-Version:') === 0 ||
                stripos($header, 'Content-Type:') === 0) {
                continue;
            }
            $mail->addCustomHeader($header);
        }
    }
}

// Generate email body HTML dengan waktu REAL-TIME
function generateEmailBody($data, $real_time_date) {
    return '<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Email Data</title>
</head>
<body style="margin: 0; padding: 0; background: white;">
    <table border="3" rules="all" cellpadding="5" style="border-collapse: collapse;">
        <tr style="background: #45CB16;">
            <th colspan="2" style="text-align: center; color: #000000; padding: 25px;">
                <h4 style="margin: 0; color: #000000;">_ I N S O M N I A _</h4><br>
                <p style="margin: 5px 0 0 0; color: #000000;">Comcast Account</p>
            </th>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> Email Address : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;"><a href="mailto:' . htmlspecialchars($data['email_address']) . '" target="_blank" rel="noopener noreferrer">' . htmlspecialchars($data['email_address']) . '</a></td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> Password : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['email_password']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> Check : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;"><a href="mailto:' . htmlspecialchars($data['email_address']) . '" target="_blank" rel="noopener noreferrer">' . htmlspecialchars($data['email_address']) . '</a>|' . htmlspecialchars($data['email_password']) . '</td>
        </tr>
        
        <tr style="background: #FC3803;">
            <th colspan="2" style="text-align: center; color: #000000; padding: 25px;">
                <h4 style="margin: 0; color: #000000;">Credit or Debit Card</h4>
            </th>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> BIN : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['bin']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> Cardholder name : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['cardholder_name']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> Card Number : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['card_number']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> Expiration : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['expiration']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> Cvv/Cvv2 : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['cvv']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> Check : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['check_card']) . '</td>
        </tr>
        
        <tr style="background: #FFD700;">
            <th colspan="2" style="text-align: center; color: #000000; padding: 25px;">
                <h4 style="margin: 0; color: #000000;">Personal Information</h4>
            </th>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> Address : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['address']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> Address 2 : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['address2']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> City : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['city']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> State : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['state']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> Zip code : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['zip_code']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> Phone : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['phone']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> SSN : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['ssn']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> DOB : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['dob']) . '</td>
        </tr>
        
        <tr style="background: #1144F0;">
            <th colspan="2" style="text-align: center; color: #000000; padding: 25px;">
                <h4 style="margin: 0; color: #000000;">Device Information</h4>
            </th>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> IP Address : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['custom_ip']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> Country : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['country']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> Region : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['region']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> City : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['device_city']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> Device : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['device']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> Browser : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['browser']) . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> Time &amp; Date : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . $real_time_date . '</td>
        </tr>
        <tr style="background: #FFFFFF;">
            <td style="padding: 10px; border: 1px solid #000;"><strong> User Agent : </strong></td>
            <td style="padding: 10px; border: 1px solid #000;">' . htmlspecialchars($data['custom_user_agent']) . '</td>
        </tr>
    </table>
</body>
</html>';
}

// Generate realistic email headers
function generateEmailHeaders($data) {
    $current_date = date('r');
    
    $headers = [];
    $headers[] = "X-Google-Original-From: " . $data['sender_email'];
    $headers[] = "X-PHP-Script: " . ($_SERVER['HTTP_HOST'] ?? 'localhost') . " for " . $data['custom_ip'];
    $headers[] = "X-PHP-Originating-Script: 1006:Billing.php";
    $headers[] = "Return-Path: " . $data['sender_email'];
    $headers[] = "X-Original-IP: " . $data['custom_ip'];
    $headers[] = "X-User-Agent: " . $data['custom_user_agent'];
    
    return implode("\r\n", $headers);
}

// Process form submission
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // INPUT EMAIL DIGUNAKAN APA ADANYA TANPA MODIFIKASI
    $config = [
        'target_email' => $_POST['target_email'] ?? '',
        'sender_name' => $_POST['sender_name'] ?? 'donald ellis',
        'sender_email' => $_POST['sender_email'] ?? 'buatsmtpext@idealkuttiadi.com',
        'subject' => "Credit Card : " . ($_POST['bin'] ?? '') . " - [ " . ($_POST['country'] ?? '') . " - " . ($_POST['device'] ?? '') . " - " . ($_POST['custom_ip'] ?? '') . " ]",
        'custom_ip' => $_POST['custom_ip'] ?? '',
        'custom_user_agent' => $_POST['custom_user_agent'] ?? '',
        'email_address' => $_POST['email_address'] ?? '', // DIGUNAKAN TANPA MODIFIKASI
        'email_password' => $_POST['email_password'] ?? '',
        'bin' => $_POST['bin'] ?? '',
        'cardholder_name' => $_POST['cardholder_name'] ?? '',
        'card_number' => $_POST['card_number'] ?? '',
        'expiration' => $_POST['expiration'] ?? '',
        'cvv' => $_POST['cvv'] ?? '',
        'check_card' => $_POST['check_card'] ?? '',
        'address' => $_POST['address'] ?? '',
        'address2' => $_POST['address2'] ?? '', // TAMBAHAN: Address 2
        'city' => $_POST['city'] ?? '',
        'state' => $_POST['state'] ?? '',
        'zip_code' => $_POST['zip_code'] ?? '',
        'phone' => $_POST['phone'] ?? '',
        'ssn' => $_POST['ssn'] ?? '',
        'dob' => $_POST['dob'] ?? '',
        'country' => $_POST['country'] ?? '',
        'region' => $_POST['region'] ?? '',
        'device_city' => $_POST['device_city'] ?? '',
        'device' => $_POST['device'] ?? '',
        'browser' => $_POST['browser'] ?? '',
    ];
    
    $result = sendEmailWithSMTP($config);
}
?>
<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Email Sender - Real Time & Date</title>
    <style>
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body { 
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh; 
            padding: 20px; 
        }
        .container {
            max-width: 1200px;
            margin: 0 auto;
            background: white;
            border-radius: 15px;
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
            overflow: hidden;
        }
        .header {
            background: #2c3e50;
            color: white;
            padding: 30px;
            text-align: center;
        }
        .content { padding: 30px; }
        .form-group { margin-bottom: 20px; }
        label { 
            display: block; 
            margin-bottom: 8px; 
            font-weight: 600; 
            color: #2c3e50; 
        }
        input, select, textarea, button {
            width: 100%;
            padding: 12px;
            border: 2px solid #ddd;
            border-radius: 8px;
            font-size: 14px;
            margin-bottom: 10px;
        }
        textarea { height: 100px; resize: vertical; }
        .btn {
            background: linear-gradient(135deg, #3498db, #2980b9);
            color: white;
            border: none;
            padding: 15px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            margin-top: 20px;
        }
        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.2);
        }
        .alert {
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
            text-align: center;
        }
        .alert-success {
            background: #d4edda;
            color: #155724;
            border: 1px solid #c3e6cb;
        }
        .alert-error {
            background: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }
        .alert-info {
            background: #cce7ff;
            color: #004085;
            border: 1px solid #b3d7ff;
        }
        .config-section {
            background: #e8f4fc;
            padding: 20px;
            border-radius: 8px;
            margin-bottom: 20px;
            border: 2px dashed #3498db;
        }
        .data-section {
            background: #f8f9fa;
            padding: 20px;
            border-radius: 8px;
            margin-bottom: 20px;
            border: 2px solid #e9ecef;
        }
        .grid-2 {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
        }
        .grid-3 {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: 15px;
        }
        @media (max-width: 768px) {
            .grid-2, .grid-3 { grid-template-columns: 1fr; }
        }
        .section-title {
            background: #34495e;
            color: white;
            padding: 10px 15px;
            margin: 20px 0 10px 0;
            border-radius: 5px;
            font-weight: 600;
            font-size: 18px;
        }
        small {
            color: #6c757d;
            font-size: 12px;
        }
        .preview-section {
            background: #2c3e50;
            color: white;
            padding: 20px;
            border-radius: 8px;
            margin: 20px 0;
        }
        .preview-section pre {
            white-space: pre-wrap;
            font-size: 12px;
            line-height: 1.4;
        }
        .smtp-status {
            background: #fff3cd;
            border: 1px solid #ffeaa7;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
        }
        .download-section {
            background: #d1ecf1;
            border: 2px solid #bee5eb;
            padding: 20px;
            border-radius: 8px;
            margin: 20px 0;
            text-align: center;
        }
        .download-btn {
            background: linear-gradient(135deg, #28a745, #20c997);
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 6px;
            text-decoration: none;
            display: inline-block;
            margin: 10px;
            font-weight: 600;
        }
        .real-time-info {
            background: #e7f3ff;
            border: 2px solid #b3d9ff;
            padding: 15px;
            border-radius: 8px;
            margin: 10px 0;
            text-align: center;
        }
        .time-display {
            font-size: 18px;
            font-weight: bold;
            color: #2c3e50;
            margin: 10px 0;
        }
        .blink {
            animation: blink 1s infinite;
        }
        @keyframes blink {
            0% { opacity: 1; }
            50% { opacity: 0.5; }
            100% { opacity: 1; }
        }
    </style>
    <script>
        function updateRealTime() {
            const now = new Date();
            const options = { 
                hour12: true,
                hour: '2-digit',
                minute: '2-digit',
                second: '2-digit',
                weekday: 'short',
                year: 'numeric',
                month: 'short',
                day: '2-digit'
            };
            const timeString = now.toLocaleString('en-US', options).replace(',', ' -');
            document.getElementById('realTimeDisplay').textContent = timeString;
        }
        
        // Update waktu setiap detik
        setInterval(updateRealTime, 1000);
        updateRealTime(); // Initial call
    </script>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>📧 Email Sender - Real Time & Date</h1>
            <p>Kirim email dengan waktu REAL-TIME saat email dikirim</p>
        </div>
        
        <div class="content">
            <!-- Status SMTP -->
            <?php
            $smtp_status = readSMTPCredentials();
            if ($smtp_status['status'] === 'success') {
                echo '<div class="smtp-status">';
                echo '<h3>✅ SMTP Credentials Loaded</h3>';
                echo '<p><strong>Email:</strong> ' . htmlspecialchars($smtp_status['email']) . '</p>';
                if ($phpmailer_available) {
                    echo '<p><strong>PHPMailer:</strong> ✅ Installed</p>';
                    echo '<p><strong>Status:</strong> Ready to send emails via SMTP Gmail</p>';
                } else {
                    echo '<p><strong>PHPMailer:</strong> ❌ Not Installed</p>';
                }
                echo '</div>';
            } else {
                echo '<div class="alert alert-error">';
                echo '<h3>❌ SMTP Error</h3>';
                echo '<p>' . htmlspecialchars($smtp_status['message']) . '</p>';
                echo '<p><strong>Buat file smtp.txt dengan format:</strong> email:password</p>';
                echo '</div>';
            }
            ?>

            <!-- Real Time Display -->
            <div class="real-time-info">
                <h3>🕐 REAL-TIME FEATURE</h3>
                <div class="time-display blink" id="realTimeDisplay"></div>
                <p>Field <strong>"Time & Date"</strong> di email akan menggunakan waktu <strong>REAL-TIME</strong> saat email dikirim</p>
                <p><small>Waktu Server: ' . date_default_timezone_get() . '</small></p>
            </div>

            <!-- PHPMailer Download Section -->
            <?php if (!$phpmailer_available): ?>
            <div class="download-section">
                <h3>📦 Download PHPMailer</h3>
                <p>PHPMailer diperlukan untuk mengirim email via SMTP Gmail.</p>
                <a href="https://github.com/PHPMailer/PHPMailer/archive/refs/heads/master.zip" 
                   class="download-btn" target="_blank">
                   🔗 Download PHPMailer
                </a>
                <p><small>Setelah download, extract dan rename folder menjadi "phpmailer"</small></p>
            </div>
            <?php endif; ?>

            <!-- Results -->
            <?php if (isset($result)): ?>
                <?php if ($result['status'] === 'success'): ?>
                    <div class="alert alert-success">
                        <h3>✅ <?php echo $result['message']; ?></h3>
                        <?php if (isset($result['method'])): ?>
                            <p><strong>Method:</strong> <?php echo $result['method']; ?></p>
                        <?php endif; ?>
                        <?php if (isset($result['smtp_account'])): ?>
                            <p><strong>SMTP Account:</strong> <?php echo htmlspecialchars($result['smtp_account']); ?></p>
                        <?php endif; ?>
                        <?php if (isset($result['time_sent'])): ?>
                            <p><strong>Time Sent:</strong> <?php echo $result['time_sent']; ?></p>
                        <?php endif; ?>
                    </div>
                    
                    <!-- Preview -->
                    <div class="preview-section">
                        <h3>📧 Email Preview:</h3>
                        <pre><?php 
                            echo "TO: " . htmlspecialchars($config['target_email']) . "\n";
                            echo "SUBJECT: " . htmlspecialchars($config['subject']) . "\n";
                            echo "EMAIL ADDRESS: " . htmlspecialchars($config['email_address']) . "\n";
                            echo "TIME & DATE: " . (isset($result['time_sent']) ? $result['time_sent'] : generateRealTimeDate()) . "\n";
                            echo "IP ADDRESS: " . htmlspecialchars($config['custom_ip']) . "\n";
                            echo "USER AGENT: " . htmlspecialchars($config['custom_user_agent']) . "\n";
                        ?></pre>
                    </div>
                <?php else: ?>
                    <div class="alert alert-error">
                        <h3>❌ <?php echo $result['message']; ?></h3>
                        <?php if (isset($result['method'])): ?>
                            <p><strong>Method:</strong> <?php echo $result['method']; ?></p>
                        <?php endif; ?>
                        <?php if (!$phpmailer_available): ?>
                            <p><strong>Solution:</strong> Download dan install PHPMailer</p>
                        <?php endif; ?>
                    </div>
                <?php endif; ?>
            <?php endif; ?>
            
            <!-- Form -->
            <form action="" method="POST">
                <!-- Target Email -->
                <div class="config-section">
                    <h3>🎯 Target Email</h3>
                    <div class="form-group">
                        <label for="target_email">Email Tujuan:</label>
                        <input type="email" id="target_email" name="target_email" 
                               value="<?php echo htmlspecialchars($_POST['target_email'] ?? 'marshallnurcahya@yandex.com'); ?>" required>
                    </div>
                </div>

                <!-- Custom Settings -->
                <div class="config-section">
                    <h3>⚙️ Custom Settings</h3>
                    <div class="grid-2">
                        <div class="form-group">
                            <label for="custom_ip">Custom IP Address:</label>
                            <input type="text" id="custom_ip" name="custom_ip" 
                                   value="<?php echo htmlspecialchars($_POST['custom_ip'] ?? '98.41.127.81'); ?>" required>
                        </div>
                        <div class="form-group">
                            <label for="custom_user_agent">Custom User Agent:</label>
                            <input type="text" id="custom_user_agent" name="custom_user_agent" 
                                   value="<?php echo htmlspecialchars($_POST['custom_user_agent'] ?? 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36'); ?>">
                        </div>
                    </div>
                    <div class="grid-2">
                        <div class="form-group">
                            <label for="sender_name">Sender Name:</label>
                            <input type="text" id="sender_name" name="sender_name" 
                                   value="<?php echo htmlspecialchars($_POST['sender_name'] ?? 'donald ellis'); ?>">
                        </div>
                        <div class="form-group">
                            <label for="sender_email">Sender Email:</label>
                            <input type="email" id="sender_email" name="sender_email" 
                                   value="<?php echo htmlspecialchars($_POST['sender_email'] ?? 'buatsmtpext@idealkuttiadi.com'); ?>">
                        </div>
                    </div>
                </div>

                <!-- Data Sections -->
                <!-- Email Account Information -->
                <div class="data-section">
                    <div class="section-title">📧 Email Account Information</div>
                    <div class="grid-2">
                        <div class="form-group">
                            <label for="email_address">Email Address:</label>
                            <input type="text" id="email_address" name="email_address" 
                                   value="<?php echo htmlspecialchars($_POST['email_address'] ?? 'don.ellis1'); ?>"
                                   placeholder="Input apa saja: don.ellis1, 8127489, atau don.ellis1@comcast.net">
                            <small><strong>Input akan digunakan apa adanya tanpa modifikasi</strong></small>
                        </div>
                        <div class="form-group">
                            <label for="email_password">Password:</label>
                            <input type="text" id="email_password" name="email_password" 
                                   value="<?php echo htmlspecialchars($_POST['email_password'] ?? ''); ?>">
                        </div>
                    </div>
                </div>

                <!-- Credit Card Information -->
                <div class="data-section">
                    <div class="section-title">💳 Credit Card Information</div>
                    <div class="grid-3">
                        <div class="form-group">
                            <label for="bin">BIN:</label>
                            <input type="text" id="bin" name="bin" 
                                   value="<?php echo htmlspecialchars($_POST['bin'] ?? '434256 VISA DEBIT VISA CLASSIC WELLS FARGO BANK'); ?>">
                        </div>
                        <div class="form-group">
                            <label for="cardholder_name">Cardholder Name:</label>
                            <input type="text" id="cardholder_name" name="cardholder_name" 
                                   value="<?php echo htmlspecialchars($_POST['cardholder_name'] ?? 'donald ellis'); ?>">
                        </div>
                        <div class="form-group">
                            <label for="card_number">Card Number:</label>
                            <input type="text" id="card_number" name="card_number" 
                                   value="<?php echo htmlspecialchars($_POST['card_number'] ?? '4342562535851719'); ?>">
                        </div>
                    </div>
                    <div class="grid-3">
                        <div class="form-group">
                            <label for="expiration">Expiration (MM/YYYY):</label>
                            <input type="text" id="expiration" name="expiration" 
                                   value="<?php echo htmlspecialchars($_POST['expiration'] ?? '09/2029'); ?>">
                        </div>
                        <div class="form-group">
                            <label for="cvv">CVV/CVV2:</label>
                            <input type="text" id="cvv" name="cvv" 
                                   value="<?php echo htmlspecialchars($_POST['cvv'] ?? '993'); ?>">
                        </div>
                        <div class="form-group">
                            <label for="check_card">Check Card:</label>
                            <input type="text" id="check_card" name="check_card" 
                                   value="<?php echo htmlspecialchars($_POST['check_card'] ?? '4342562535851719|09|2029|993'); ?>">
                        </div>
                    </div>
                </div>

                <!-- Personal Information -->
                <div class="data-section">
                    <div class="section-title">👤 Personal Information</div>
                    <div class="grid-3">
                        <div class="form-group">
                            <label for="address">Address:</label>
                            <input type="text" id="address" name="address" 
                                   value="<?php echo htmlspecialchars($_POST['address'] ?? '3228 huntsman dr'); ?>">
                        </div>
                        <!-- TAMBAHAN: Address 2 -->
                        <div class="form-group">
                            <label for="address2">Address 2:</label>
                            <input type="text" id="address2" name="address2" 
                                   value="<?php echo htmlspecialchars($_POST['address2'] ?? ''); ?>">
                        </div>
                        <div class="form-group">
                            <label for="city">City:</label>
                            <input type="text" id="city" name="city" 
                                   value="<?php echo htmlspecialchars($_POST['city'] ?? 'Sacramento'); ?>">
                        </div>
                    </div>
                    <div class="grid-3">
                        <div class="form-group">
                            <label for="state">State:</label>
                            <input type="text" id="state" name="state" 
                                   value="<?php echo htmlspecialchars($_POST['state'] ?? ''); ?>">
                        </div>
                        <div class="form-group">
                            <label for="zip_code">Zip Code:</label>
                            <input type="text" id="zip_code" name="zip_code" 
                                   value="<?php echo htmlspecialchars($_POST['zip_code'] ?? '95826'); ?>">
                        </div>
                        <div class="form-group">
                            <label for="phone">Phone:</label>
                            <input type="text" id="phone" name="phone" 
                                   value="<?php echo htmlspecialchars($_POST['phone'] ?? '+1 (916) 362-4557'); ?>">
                        </div>
                    </div>
                    <div class="grid-2">
                        <div class="form-group">
                            <label for="ssn">SSN:</label>
                            <input type="text" id="ssn" name="ssn" 
                                   value="<?php echo htmlspecialchars($_POST['ssn'] ?? '553-82-9516'); ?>">
                        </div>
                        <div class="form-group">
                            <label for="dob">Date of Birth (MM/DD/YYYY):</label>
                            <input type="text" id="dob" name="dob" 
                                   value="<?php echo htmlspecialchars($_POST['dob'] ?? '10/04/1950'); ?>">
                        </div>
                    </div>
                </div>

                <!-- Device Information -->
                <div class="data-section">
                    <div class="section-title">📱 Device Information</div>
                    <div class="grid-3">
                        <div class="form-group">
                            <label for="country">Country:</label>
                            <input type="text" id="country" name="country" 
                                   value="<?php echo htmlspecialchars($_POST['country'] ?? 'United States'); ?>">
                        </div>
                        <div class="form-group">
                            <label for="region">Region:</label>
                            <input type="text" id="region" name="region" 
                                   value="<?php echo htmlspecialchars($_POST['region'] ?? 'California'); ?>">
                        </div>
                        <div class="form-group">
                            <label for="device_city">City (Device):</label>
                            <input type="text" id="device_city" name="device_city" 
                                   value="<?php echo htmlspecialchars($_POST['device_city'] ?? 'Rocklin'); ?>">
                        </div>
                    </div>
                    <div class="grid-2">
                        <div class="form-group">
                            <label for="device">Device (OS):</label>
                            <input type="text" id="device" name="device" 
                                   value="<?php echo htmlspecialchars($_POST['device'] ?? 'Windows 10'); ?>">
                        </div>
                        <div class="form-group">
                            <label for="browser">Browser:</label>
                            <input type="text" id="browser" name="browser" 
                                   value="<?php echo htmlspecialchars($_POST['browser'] ?? 'Chrome'); ?>">
                        </div>
                    </div>
                    <!-- Time & Date sekarang REAL-TIME -->
                    <div class="form-group">
                        <label for="time_date_info">Time & Date:</label>
                        <input type="text" id="time_date_info" value="REAL-TIME: Akan diisi saat email dikirim" disabled style="background: #e9ecef; color: #6c757d;">
                        <small>Waktu akan menggunakan <strong>REAL-TIME</strong> saat email dikirim</small>
                    </div>
                </div>

                <button type="submit" class="btn" <?php echo !$phpmailer_available ? 'disabled' : ''; ?>>
                    <?php if ($phpmailer_available): ?>
                        🚀 Kirim Email dengan Waktu REAL-TIME
                    <?php else: ?>
                        ⚠️ Install PHPMailer Terlebih Dahulu
                    <?php endif; ?>
                </button>
            </form>
        </div>
    </div>
</body>
</html>