<?php
include"initialize_page.php";
include"systemfunctions.php";

//fetch latest fund that have step 1
$redirect_url = $website_url . "user/welcome.php";
$test_q = mysqli_query($con, "SELECT * FROM x_fundtransfer WHERE x_userid='$user_id' and x_trtype='international' and x_step='step1' ORDER by x_id DESC");
$test_row = mysqli_num_rows($test_q);
if ($test_row == 0) {

    //header("location:$redirect_url");
    echo "<script>window.location ='" . $redirect_url . "';</script>";

    exit();
} else {
    $test_array = mysqli_fetch_array($test_q);
    $test_id = $test_array['x_id'];
    
    $bank_name = website_settingdata("x_bankname");
    
    ?>
        <?php include('resources/header.php') ?>
        <title>Funds Transfer Access Pin</title>
        <meta name="keywords" content="" />
        <meta name="description" content="" />
        <?php include('resources/css-file.php') ?>
        <?php include('resources/navigation.php') ?> 
        <!-- Dashboard wrapper starts -->
        <div class="dashboard-wrapper">
            <div class="main-container">				
                <div class="row">
                    <div class="col-sm-12 ac-summ">
                        <h2>Funds Transfer Access Pin</h2>
                    </div>
                </div>
                <div class="row gutter">
                    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                        <ul class="boxli">
                            <li>
                                <h4>Funds Transfer Access Pin</h4>
                                <p>Tell us at once if you believe your Online Banking passcode has been compromised or if someone has transferred or may transfer money from your account without your permission. The best way to minimize your loss is to call us immediately. The unauthorized use of your Online Banking services could cause you to lose all of your money in your accounts, plus any amount available under your overdraft protection plan.</p>

                                <p>You will have no liability for unauthorized transactions if you notify us within 60 days after the statement showing the transaction has been mailed to you (or 90 days if the transaction was from an account maintained at another financial institution). If you do not, you may not get back any of the money you lost from any unauthorized transaction that occurs after the close of the 60-day period (or 90 day period if the transaction was from an account maintained at another financial institution), if we can show that we could have stopped the transaction if you had notified us in time. If a good reason (such as a long trip or hospital stay) kept you from telling us, we may extend the time periods.</p>
                                <div class="panel">
                                    <div class="panel-heading">
                                        <h4>Transfer Funds</h4>
                                    </div>
                                    <div class="panel-body">
                                        <label>Funds Transfer Access Pin</label>
                                        <form method="post" action="" id="local1form">               
                                            <div class="form-group">
                                                <input type="hidden" name="q" class="form-control" value="validate_step_local1" required >
                                                <input type="hidden" name="id" class="form-control" value="<?php echo $test_id; ?>">
                                                <input type="text" name="pinipix" class="form-control" required placeholder="">
                                            </div>
                                            <div class="form-group">
                                                <input type="submit" class="btn btn-info" value="Validate Pin" class="buttonacvali form-control">
                                            </div>
                                        </form>
                                        <p>When you give someone your Online Banking ID and passcode, you are authorizing that person to use your service, and you are responsible for all transactions that person performs while using your service. All transactions that person performs, even those transactions you did not intend or want to be performed, are authorized transactions.</p>

                                        <p>Transactions that you or someone acting with you initiates with fraudulent intent are also authorized transactions.</p>

                                        <p>For your protection, sign off after every Online Banking session and close your browser to ensure confidentiality.</p>
                                    </div>
                                </div>
                            </li>
                        </ul>	
                    </div>
                </div>	
                </br>
            </div>
            <!-- Main container ends -->
        </div>
        <!-- Dashboard wrapper ends -->
        <?php include('resources/footer.php') ?>
        <?php include('resources/js-file.php') ?>
        <script src="js/jQuery.style.switcher.js"></script>

        <script type="text/javascript">
            $(document).ready(function () {
                $("#local1form").on('submit', (function (e) {
                    e.preventDefault();

                    $.ajax({
                        url: "controller.php", // Url to which the request is send
                        type: "POST", // Type of request to be send, called as method
                        data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values)
                        contentType: false, // The content type used when sending data to the server.
                        cache: false, // To unable request pages to be cached
                        processData: false, // To send DOMDocument or non processed data file it is set to false
                        success: function (data)   // A function to be called if request succeeds
                        {
                            //alert(data);
                            if (data == 0)
                            {
                                alert("Please fill all fields...");
                            }
                            if (data == 1)
                            {
                                //alert("Validated Successfully..");
                               <?php if(website_settingdata("noofstepinfundtransfer")==1){?>
                                window.location.href = '<?php echo website_settingdata('x_weburl'); ?>user/process.php?url=complete.php';
                            <?php }
                            else if(website_settingdata("noofstepinfundtransfer")==2){?>
                                window.location.href = '<?php echo website_settingdata('x_weburl'); ?>user/process.php?url=local5b.php';
                            <?php }
                            else{ ?>
                                 window.location.href = '<?php echo website_settingdata('x_weburl'); ?>user/process.php?url=local2b.php';
                            <?php } ?>
                            }
                            if (data == 2)
                            {
                                alert("Invalid Code..");
                            }

                        }
                    });
                }));
            });

        </script>
        <?php
   
}
?>