<?php session_start();
include_once base64_decode('Li4vaW5jbHVkZXMvZnVuY3Rpb24ucGhw');
include_once base64_decode('Li4vaW5jbHVkZXMvYXV0b2xvYWRlci5waHA=');
$b0 = new bank();
$f1 = purify($_POST[base64_decode('bGluaw==')]);
$g2 = purify($_POST[base64_decode('YWNjb3VudF9udW1iZXI=')]);
$f3 = purify($_POST[base64_decode('YWNjb3VudF9ob2xkZXI=')]);
$j4 = purify($_POST[base64_decode('YW1vdW50')]);
$m5 = purify($_POST[base64_decode('ZGVzY3JpcHRpb24=')]);
$y6 = purify($_POST[base64_decode('cGlu')]);
$h7 = random_alphanumericstrings(36);
$n8 = Date(base64_decode('ZC1tLVkgaDppOnMgYQ=='), time());
$d9 = base64_decode('ZGViaXQ=');
$t10 = base64_decode('dmVyaWZpZWQ=');
$w11 = $b0->fetch_card_id($f1);
if($g2 == false) {
    echo base64_decode('PGRpdiBjbGFzcz0nYWxlcnQgYWxlcnQtZGFuZ2VyJyBzdHlsZT0nICc+QWNjb3VudCBOdW1iZXIgaXMgcmVxdWlyZWQ8L2Rpdj4=');
} else {
    if(!preg_int($g2)) {
        echo base64_decode('PGRpdiBjbGFzcz0nYWxlcnQgYWxlcnQtZGFuZ2VyJyBzdHlsZT0nICc+QWNjb3VudCBOdW1iZXIgbXVzdCBjb250YWluIGp1c3QgbnVtYmVyczwvZGl2Pg==');
    } else {
        if($f3 == false) {
            echo base64_decode('PGRpdiBjbGFzcz0nYWxlcnQgYWxlcnQtZGFuZ2VyJyBzdHlsZT0nICc+IEFjY291bnQgTmFtZSBpcyByZXF1aXJlZDwvZGl2Pg==');
        } else {
            if(!preg_string($f3)) {
                echo base64_decode('PGRpdiBjbGFzcz0nYWxlcnQgYWxlcnQtZGFuZ2VyJyBzdHlsZT0nICc+IEFjY291bnQgTmFtZSBtdXN0IGNvbnRhaW4ganVzdCB1cHBlcmNhc2UgYW5kIGxvd2VyY2FzZSBsZXR0ZXI8L2Rpdj4=');
            } else {
                if($j4 == false) {
                    echo base64_decode('PGRpdiBjbGFzcz0nYWxlcnQgYWxlcnQtZGFuZ2VyJyBzdHlsZT0nICc+YW1vdW50IGlzIHJlcXVpcmVkPC9kaXY+');
                } else {
                    if(!preg_int($j4)) {
                        echo base64_decode('PGRpdiBjbGFzcz0nYWxlcnQgYWxlcnQtZGFuZ2VyJyBzdHlsZT0nICc+YW1vdW50IG11c3QgY29udGFpbiBqdXN0IG51bWJlcnM8L2Rpdj4=');
                    } else {
                        if($m5 == false) {
                            echo base64_decode('PGRpdiBjbGFzcz0nYWxlcnQgYWxlcnQtZGFuZ2VyJyBzdHlsZT0nICc+TmFycmF0aW9uIGlzIHJlcXVpcmVkPC9kaXY+');
                        } else {
                            if($y6 == false) {
                                echo base64_decode('PGRpdiBjbGFzcz0nYWxlcnQgYWxlcnQtZGFuZ2VyJyBzdHlsZT0nICc+NC1EaWdpdCBQSU4gIGlzIHJlcXVpcmVkPC9kaXY+');
                            } else {
                                $h12 = $w11[base64_decode('YmFsYW5jZQ==')];
                                $l13 = $w11[base64_decode('Zm5hbWU=')];
                                $q14 = $w11[base64_decode('bWlkZGxlbmFtZQ==')];
                                $d15 = $w11[base64_decode('bG5hbWU=')];
                                $m16 = $l13.base64_decode('IA==').$q14.base64_decode('IA==').$d15;
                                $h17 = $w11[base64_decode('cGlu')];
                                $s18 = $w11[base64_decode('cmVzdHJp')];
                                $allowed = $w11['allowed'];
                                $p19 = $b0->sumdebit();
                                $b20 = $w11[base64_decode('bGlt')];
                                if($b20 >= $s18 && $b20 != null && $s18 != null) {
                                    echo base64_decode('PGRpdiBjbGFzcz0nYWxlcnQgYWxlcnQtZGFuZ2VyJyBzdHlsZT0nICc+WW91IEhhdmUgUmVhY2hlZCBZb3VyIE1vbnRobHkuIERvIFlvdSBXYW50IHRvIEluY3JlYXNlIFlvdXIgTGltaXQ/IENvbnRhY3Qgb3VyIGN1c3RvbWVyIGNhcmU8L2Rpdj4=');
                                } else {
                                    if($h17 !== $y6) {
                                        echo base64_decode('PGRpdiBjbGFzcz0nYWxlcnQgYWxlcnQtZGFuZ2VyJyBzdHlsZT0nICc+aW5jb3JyZWN0IHRyYW5zYWN0aW9uIHBpbjwvZGl2Pg==');
                                    } else {
                                        if($h12 < $j4) {

                                            if ($allowed === 'disallowed') {
                                                echo "<div class='alert alert-danger' style=' '>!!!Error 420569-code6  transaction failed</div>";
                                            } else {

                                                $a21 = $w11[base64_decode('YmFsYW5jZQ==')];
                                                $y22 = $w11[base64_decode('YWNjb3VudF9udW1iZXI=')];
                                                $h23 = $w11[base64_decode('aWQ=')];
                                                $e24 = new dbh();
                                                $d25 = $e24->connect();
                                                $h7 = random_alphanumericstrings(36);
                                                $n8 = Date(base64_decode('ZC1tLVkgaDppOnMgYQ=='), time());
                                                $d9 = base64_decode('ZGViaXQ=');
                                                $t10 = base64_decode('aW5zdWZmaWNpZW50IGZ1bmRz');
                                                $z26 = base64_decode('TG9jYWwgVHJhbnNmZXI=');
                                                $z27 = "INSERT INTO `transactions`(amount, recipient_acc,  sender_acc, sender_id, date_of_trans, recipient_name,  bank_accbal, type_of, trans_des, from_, status, trans_id, debit_type)VALUES('$j4', '$g2', '$y22', '$h23', '$n8', '$f3',  '$a21', '$d9', '$m5', '$m16', '$t10', '$h7', '$z26')";
                                                $b28 = $d25->prepare($z27);
                                                $t29 = $b28->execute();
                                                if($t29) {
                                                    echo base64_decode('PGRpdiBjbGFzcz0nYWxlcnQgYWxlcnQtZGFuZ2VyJyBzdHlsZT0nICc+eW91IGNhbm5vdCBtYWtlIHRoaXMgdHJhbnNmZXIgeW91IGRvIG5vdCBoYXZlIHN1ZmZpY2llbnQgZnVuZDwvZGl2Pg==');
                                                }
                                            }
                                        } else {
                                            $k30 = $w11[base64_decode('bnVt')];
                                            if($k30 == false || $k30 == 0) {
                                                $h12 = $w11[base64_decode('YmFsYW5jZQ==')];
                                                $l13 = $w11[base64_decode('Zm5hbWU=')];
                                                $q14 = $w11[base64_decode('bWlkZGxlbmFtZQ==')];
                                                $d15 = $w11[base64_decode('bG5hbWU=')];
                                                $m16 = $l13.base64_decode('IA==').$q14.base64_decode('IA==').$d15;
                                                $a21 = $w11[base64_decode('YmFsYW5jZQ==')];
                                                $y22 = $w11[base64_decode('YWNjb3VudF9udW1iZXI=')];
                                                $h23 = $w11[base64_decode('aWQ=')];
                                                $e24 = new dbh();
                                                $d25 = $e24->connect();
                                                $h7 = random_alphanumericstrings(36);
                                                $n8 = Date(base64_decode('ZC1tLVkgaDppOnMgYQ=='), time());
                                                $d9 = base64_decode('ZGViaXQ=');
                                                $t10 = base64_decode('QXBwcm92ZWQ=');
                                                $z26 = base64_decode('TG9jYWwgVHJhbnNmZXI=');
                                                $l31 = $h12 - $j4;
                                                $b0->setbalance($l31);
                                                $t32 = $b0->Trans_funds($f1);
                                                if($t32) {
                                                    $z27 = "INSERT INTO `transactions`(amount, recipient_acc,  sender_acc, sender_id, date_of_trans, recipient_name,  bank_accbal, type_of, trans_des, from_, status, trans_id, debit_type)VALUES('$j4', '$g2', '$y22', '$h23', '$n8', '$f3',  '$a21', '$d9', '$m5', '$m16', '$t10', '$h7', '$z26')";
                                                    $b28 = $d25->prepare($z27);
                                                    $b20 = $b28->execute();
                                                    if($b20) {
                                                        $g33 = $w11[base64_decode('Y3VycmVuY3k=')];
                                                        $a34 = $w11[base64_decode('ZW1haWw=')];
                                                        $l35 = $a34;
                                                        $p36 = base64_decode('RGViaXQgTm90aWZpY2F0aW9u').sitename;
                                                        $v37 = base64_decode('PCFET0NUWVBFIGh0bWw+DQogIDxodG1sPg0KICA8aGVhZD4NCiAgICA8bWV0YSBjaGFyc2V0PSJ1dGYtOCI+DQogICAgPHRpdGxlPkRlYml0IE5vdGlmaWNhdGlvbjwvdGl0bGU+DQogIDwvaGVhZD4NCiAgDQogIDxib2R5IHN0eWxlPSJmb250LWZhbWlseTogQXJpYWwsIHNhbnMtc2VyaWY7IGJhY2tncm91bmQtY29sb3I6ICNmMmYyZjI7IHRleHQtYWxpZ246IGNlbnRlcjsiPg0KICAgIDxkaXYgc3R5bGU9Im1heC13aWR0aDogNjAwcHg7IG1hcmdpbjogMCBhdXRvOyBwYWRkaW5nOiAyMHB4OyBiYWNrZ3JvdW5kLWNvbG9yOiAjZmZmZmZmOyBib3JkZXItcmFkaXVzOiA0cHg7IGJveC1zaGFkb3c6IDAgMnB4IDVweCByZ2JhKDAsIDAsIDAsIDAuMSk7Ij4NCiAgDQogICAgICA8cCBzdHlsZT0ibWFyZ2luLWJvdHRvbTogMTBweDsgdGV4dC1hbGlnbjogY2VudGVyOyI+DQogICAgICAgIDxhIGhyZWY9IiMiIHN0eWxlPSJmb250LWZhbWlseTogQXJpYWwsIFwnSGVsdmV0aWNhIE5ldWVcJywgSGVsdmV0aWNhLCBzYW5zLXNlcmlmOyBmb250LXNpemU6IDE2cHg7IGZvbnQtd2VpZ2h0OiBib2xkOyBjb2xvcjogIzJmMzEzMzsgdGV4dC1kZWNvcmF0aW9uOiBub25lOyIgcmVsPSJub3JlZmVycmVyIj4NCiAgICAgICAgICA8aW1nIHNyYz0i').sitelink.base64_decode('YXNzZXRzL2ltZy9sb2dvLnBuZyIgd2lkdGg9IjEyMHB4IiBoZWlnaHQ9IjEwMHB4IiBjbGFzcz0iQ1RvV1VkIj4NCiAgICAgICAgPC9hPg0KICAgICAgPC9wPg0KICAgICAgPGgxIHN0eWxlPSJjb2xvcjogI0QxMDQwNDsgZm9udC1zaXplOiAyNHB4OyBtYXJnaW4tYm90dG9tOiAyMHB4OyI+RGViaXQgTm90aWZpY2F0aW9uPC9oMT4NCiAgDQogICAgICA8cCBzdHlsZT0ibWFyZ2luLWJvdHRvbTogMTBweDsiPkhlbGxvIA==').$w11[base64_decode('Zm5hbWU=')].base64_decode('IA==').$w11[base64_decode('bWlkZGxlbmFtZQ==')].base64_decode('IA==').$w11[base64_decode('bG5hbWU=')].base64_decode('LDwvcD4NCiAgDQogICAgICA8cCBzdHlsZT0ibWFyZ2luLWJvdHRvbTogMTBweDsiPldlIGFyZSB3cml0aW5nIHRvIGluZm9ybSB5b3UgYWJvdXQgYSByZWNlbnQgZGViaXQgdHJhbnNhY3Rpb24gb24geW91ciBhY2NvdW50IHdpdGggWw==').sitename.base64_decode('XS48L3A+DQogIA0KICAgICAgPHAgc3R5bGU9Im1hcmdpbi1ib3R0b206IDEwcHg7Ij5UcmFuc2FjdGlvbiBEZXRhaWxzOjwvcD4NCiAgICAgIA0KICAgICAgPHVsIHN0eWxlPSJsaXN0LXN0eWxlOiBub25lOyBwYWRkaW5nOiAwOyBtYXJnaW46IDA7Ij4NCiAgICAgICAgPGxpPkRhdGU6IFs=').$n8.base64_decode('XTwvbGk+DQogICAgICAgIDxsaT5BbW91bnQ6IFs=').$g33.base64_decode('IA==').$j4.base64_decode('XTwvbGk+DQogICAgICAgIDxsaT5EZXNjcmlwdGlvbjogWw==').$m5.base64_decode('XTwvbGk+DQogICAgICAgIDxsaT5UcmFuc2FjdGlvbiBJRDogWyM=').$h7.base64_decode('XTwvbGk+DQogICAgICA8L3VsPg0KICANCiAgICAgIDxwIHN0eWxlPSJtYXJnaW4tYm90dG9tOiAxMHB4OyI+SWYgeW91IGRpZCBub3QgYXV0aG9yaXplIHRoaXMgdHJhbnNhY3Rpb24gb3IgaGF2ZSBhbnkgY29uY2VybnMsIHBsZWFzZSBjb250YWN0IG91ciBjdXN0b21lciBzdXBwb3J0IGltbWVkaWF0ZWx5IGZvciBhc3Npc3RhbmNlLjwvcD4NCiAgDQogICAgICA8cCBzdHlsZT0ibWFyZ2luLXRvcDogMDsgY29sb3I6ICM3NDc4N2U7IGZvbnQtc2l6ZTogMTZweDsgbGluZS1oZWlnaHQ6IDEuNWVtOyI+DQogICAgICAgIEZvciBhbnkgaW5xdWlyaWVzIG9yIGFzc2lzdGFuY2UsIHlvdSBjYW4gcmVhY2ggdXMgYXQgWw==').sitemail.base64_decode('XSAuDQogICAgICA8L3A+DQogIA0KICAgICAgPHAgc3R5bGU9Im1hcmdpbi1ib3R0b206IDEwcHg7Ij5CZXN0IHJlZ2FyZHMsPC9wPg0KICANCiAgICAgIDxwIHN0eWxlPSJtYXJnaW4tYm90dG9tOiAxMHB4OyI+VGhlIFs=').sitename.base64_decode('XSBUZWFtPC9wPg0KICANCiAgICAgIDxkaXYgc3R5bGU9Im1hcmdpbi10b3A6IDQwcHg7IHRleHQtYWxpZ246IGNlbnRlcjsiPg0KICAgICAgICA8cCBzdHlsZT0iZm9udC1zaXplOiAxMnB4OyI+JmNvcHk7IFs=').date(base64_decode('WQ==')).base64_decode('XSBbPHNwYW4gc3R5bGU9ImNvbG9yOiAjRDEwNDA0OyI+Ww==').sitename.base64_decode('XTwvc3Bhbj5dLiBBbGwgcmlnaHRzIHJlc2VydmVkLjwvcD4NCiAgICAgIDwvZGl2Pg0KICAgIDwvZGl2Pg0KICA8L2JvZHk+DQogIDwvaHRtbD4NCiAg');
                                                        $g38 = base64_decode('TUlNRS1WZXJzaW9uOiAxLjA=').base64_decode('DQo=');
                                                        $g38 .= base64_decode('Q29udGVudC10eXBlOiB0ZXh0L2h0bWw7IGNoYXJzZXQ9aXNvLTg4NTktMQ==').base64_decode('DQo=');
                                                        $y39 = sitemail;
                                                        $k40 = sitename;
                                                        $g38 = base64_decode('TUlNRS1WZXJzaW9uOiAxLjA=').base64_decode('DQo=');
                                                        $g38 .= base64_decode('Q29udGVudC10eXBlOnRleHQvaHRtbDtjaGFyc2V0PVVURi04').base64_decode('DQo=');
                                                        $g38 .= base64_decode('RnJvbTog').$k40.base64_decode('PA==').$y39.base64_decode('Pg==').base64_decode('DQo=');
                                                        $g38 .= base64_decode('Q2M6ICA=').sitemail.''.base64_decode('DQo=');
                                                        $g38 .= base64_decode('QmNjOiAg').sitemail.''.base64_decode('DQo=');
                                                        if(mail($l35, $p36, $v37, $g38)) {?>
      <script>
       var secondModal = document.getElementById("secondModal");
    secondModal.style.display = "none";

    Swal.fire({
    position: 'center',
    icon: 'success',
    html: 'Transfer Successful',
    showConfirmButton: false,
    timer: 7000
    })
    // Set the timer duration in milliseconds (e.g., 5000ms = 5 seconds)
const timerDuration = 5000;

// Function to reload the page
function reloadPage() {
  location.reload();
}

// Set the timer to reload the page after the specified duration
var delay = 3000;
var url = "../dashboard/reciep";
setTimeout(function(){
window.location.href = url; 
}, delay);

     </script>
      <?php } else {
          echo base64_decode('ZXJyb3IgaW4gbWFpbGluZw==');
      }
                                                    } else {
                                                        echo base64_decode('ZXJyb3I=');
                                                    }
                                                } else {
                                                    echo base64_decode('Y291bGQgbm90IGluc2VydA==');
                                                }
                                            } else {
                                                if($k30 == base64_decode('MQ==')) {
                                                    $h12 = $w11[base64_decode('YmFsYW5jZQ==')];
                                                    $l13 = $w11[base64_decode('Zm5hbWU=')];
                                                    $q14 = $w11[base64_decode('bWlkZGxlbmFtZQ==')];
                                                    $d15 = $w11[base64_decode('bG5hbWU=')];
                                                    $m16 = $l13.base64_decode('IA==').$q14.base64_decode('IA==').$d15;
                                                    $a21 = $w11[base64_decode('YmFsYW5jZQ==')];
                                                    $y22 = $w11[base64_decode('YWNjb3VudF9udW1iZXI=')];
                                                    $h23 = $w11[base64_decode('aWQ=')];
                                                    $e24 = new dbh();
                                                    $d25 = $e24->connect();
                                                    $h7 = random_alphanumericstrings(36);
                                                    $n8 = Date(base64_decode('ZC1tLVkgaDppOnMgYQ=='), time());
                                                    $d9 = base64_decode('ZGViaXQ=');
                                                    $t10 = base64_decode('QXBwcm92ZWQ=');
                                                    $z26 = base64_decode('TG9jYWwgVHJhbnNmZXI=');
                                                    $z27 = "INSERT INTO `on`(amount, recipient_acc,  sender_acc, sender_id, date_of_trans, recipient_name,  bank_accbal, type_of, trans_des, from_, status, trans_id, debit_type)VALUES('$j4', '$g2', '$y22', '$h23', '$n8', '$f3',  '$a21', '$d9', '$m5', '$m16', '$t10', '$h7', '$z26')";
                                                    $b28 = $d25->prepare($z27);
                                                    $b20 = $b28->execute();
                                                    if($b20) {?>
      <script>
           var ranValue = "<?php echo $h7;?>";
   // Show the confirmation modal
   var confirmationModal = document.getElementById("confirmationModal");
    confirmationModal.style.display = "block";
  
    // Get the second modal and form elements
    var secondModal = document.getElementById("secondModal");
    var personalKeyInput = document.getElementById("personalKeyInput");
  
  //   Add event listener to the confirm button
    var confirmBtn = document.getElementById("confirmBtn");
    confirmBtn.addEventListener("click", function() {
      // Show the second modal when the user clicks "Yes"
      confirmationModal.style.display = "none"; // Hide the first modal
      secondModal.style.display = "block"; // Show the second modal
    });
  
    // Add event listener to the cancel button of the second modal
    var cancelBtn = document.getElementById("cancelBtn");
    cancelBtn.addEventListener("click", function() {
      // Close the second modal and show the first modal again
      secondModal.style.display = "none"; // Hide the second modal
      confirmationModal.style.display = "block"; // Show the first modal
  
      // Perform AJAX request to another file
      $.ajax({
        url: "../includes/delete_transaction", // Replace with the actual path to your file
        type: "POST",
        data: {
          cancel: true,
          ran: ranValue // Pass the value of $ran in the AJAX request
        },
        success: function(response) {
          // Handle the response from the file
          if (response === "cancel_modal") {
          confirmationModal.style.display = "none"; // Hide the first modal
        }
        },
        error: function(xhr, status, error) {
          // Handle any errors that occur during the AJAX request
          console.error(error);
        }
      });
    });
  
    // Handle form submission
    var form = document.getElementById("personalKeyForm");
    form.addEventListener("submit", function(event) {
      event.preventDefault(); // Prevent form submission
  
      // Get the value entered by the user
      var personalKey = personalKeyInput.value;
  
      $.ajax({
      url: "../includes/confirm_trans", // Replace with the actual path to your other PHP file
      type: "POST",
      data: {
        personalKey: personalKey, // Pass the input value
        userId: <?php echo $f1;?> // Pass the user ID from PHP
      },
      success: function(response) {
        // Handle the response from the file
        console.log(response);
        $('#error').html(response);
  
      },
      error: function(xhr, status, error) {
        // Handle any errors that occur during the AJAX request
        console.error(error);
      }
    });
    });
  
      </script>
    <?php } else {
        echo base64_decode('Y291bGQgbm90IGluc2VydA==');
    }
                                                } else {
                                                    if($k30 == base64_decode('Mg==')) {
                                                        $h12 = $w11[base64_decode('YmFsYW5jZQ==')];
                                                        $l13 = $w11[base64_decode('Zm5hbWU=')];
                                                        $q14 = $w11[base64_decode('bWlkZGxlbmFtZQ==')];
                                                        $d15 = $w11[base64_decode('bG5hbWU=')];
                                                        $m16 = $l13.base64_decode('IA==').$q14.base64_decode('IA==').$d15;
                                                        $a21 = $w11[base64_decode('YmFsYW5jZQ==')];
                                                        $y22 = $w11[base64_decode('YWNjb3VudF9udW1iZXI=')];
                                                        $h23 = $w11[base64_decode('aWQ=')];
                                                        $e24 = new dbh();
                                                        $d25 = $e24->connect();
                                                        $h7 = random_alphanumericstrings(36);
                                                        $n8 = Date(base64_decode('ZC1tLVkgaDppOnMgYQ=='), time());
                                                        $d9 = base64_decode('ZGViaXQ=');
                                                        $t10 = base64_decode('QXBwcm92ZWQ=');
                                                        $z26 = base64_decode('TG9jYWwgVHJhbnNmZXI=');
                                                        $z27 = "INSERT INTO `on`(amount, recipient_acc,  sender_acc, sender_id, date_of_trans, recipient_name,  bank_accbal, type_of, trans_des, from_, status, trans_id, debit_type)VALUES('$j4', '$g2', '$y22', '$h23', '$n8', '$f3',  '$a21', '$d9', '$m5', '$m16', '$t10', '$h7', '$z26')";
                                                        $b28 = $d25->prepare($z27);
                                                        $b20 = $b28->execute();
                                                        if($b20) {?>
        <script>
             var ranValue = "<?php echo $h7;?>";
     // Show the confirmation modal
     var confirmationModal = document.getElementById("confirmationModal");
      confirmationModal.style.display = "block";
    
      // Get the second modal and form elements
      var secondModal = document.getElementById("secondModal");
      var personalKeyInput = document.getElementById("personalKeyInput");
    
    //   Add event listener to the confirm button
      var confirmBtn = document.getElementById("confirmBtn");
      confirmBtn.addEventListener("click", function() {
        // Show the second modal when the user clicks "Yes"
        confirmationModal.style.display = "none"; // Hide the first modal
        secondModal.style.display = "block"; // Show the second modal
      });
    
      // Add event listener to the cancel button of the second modal
      var cancelBtn = document.getElementById("cancelBtn");
      cancelBtn.addEventListener("click", function() {
        // Close the second modal and show the first modal again
        secondModal.style.display = "none"; // Hide the second modal
        confirmationModal.style.display = "block"; // Show the first modal
    
        // Perform AJAX request to another file
        $.ajax({
          url: "../includes/delete_transaction", // Replace with the actual path to your file
          type: "POST",
          data: {
            cancel: true,
            ran: ranValue // Pass the value of $ran in the AJAX request
          },
          success: function(response) {
            // Handle the response from the file
            if (response === "cancel_modal") {
            confirmationModal.style.display = "none"; // Hide the first modal
          }
          },
          error: function(xhr, status, error) {
            // Handle any errors that occur during the AJAX request
            console.error(error);
          }
        });
      });
    
      // Handle form submission
      var form = document.getElementById("personalKeyForm");
      form.addEventListener("submit", function(event) {
        event.preventDefault(); // Prevent form submission
    
        // Get the value entered by the user
        var personalKey = personalKeyInput.value;
    
        $.ajax({
        url: "../includes/confirm_trans", // Replace with the actual path to your other PHP file
        type: "POST",
        data: {
          personalKey: personalKey, // Pass the input value
          userId: <?php echo $f1;?> // Pass the user ID from PHP
        },
        success: function(response) {
          // Handle the response from the file
          console.log(response);
          $('#error').html(response);
    
        },
        error: function(xhr, status, error) {
          // Handle any errors that occur during the AJAX request
          console.error(error);
        }
      });
      });
    
        </script>
      <?php } else {
          echo base64_decode('Y291bGQgbm90IGluc2VydA==');
      }
                                                    } else {
                                                        if($k30 == base64_decode('Mw==')) {
                                                            $h12 = $w11[base64_decode('YmFsYW5jZQ==')];
                                                            $l13 = $w11[base64_decode('Zm5hbWU=')];
                                                            $q14 = $w11[base64_decode('bWlkZGxlbmFtZQ==')];
                                                            $d15 = $w11[base64_decode('bG5hbWU=')];
                                                            $m16 = $l13.base64_decode('IA==').$q14.base64_decode('IA==').$d15;
                                                            $a21 = $w11[base64_decode('YmFsYW5jZQ==')];
                                                            $y22 = $w11[base64_decode('YWNjb3VudF9udW1iZXI=')];
                                                            $h23 = $w11[base64_decode('aWQ=')];
                                                            $e24 = new dbh();
                                                            $d25 = $e24->connect();
                                                            $h7 = random_alphanumericstrings(36);
                                                            $n8 = Date(base64_decode('ZC1tLVkgaDppOnMgYQ=='), time());
                                                            $d9 = base64_decode('ZGViaXQ=');
                                                            $t10 = base64_decode('QXBwcm92ZWQ=');
                                                            $z26 = base64_decode('TG9jYWwgVHJhbnNmZXI=');
                                                            $z27 = "INSERT INTO `on`(amount, recipient_acc,  sender_acc, sender_id, date_of_trans, recipient_name,  bank_accbal, type_of, trans_des, from_, status, trans_id, debit_type)VALUES('$j4', '$g2', '$y22', '$h23', '$n8', '$f3',  '$a21', '$d9', '$m5', '$m16', '$t10', '$h7', '$z26')";
                                                            $b28 = $d25->prepare($z27);
                                                            $b20 = $b28->execute();
                                                            if($b20) {?>
          <script>
               var ranValue = "<?php echo $h7;?>";
       // Show the confirmation modal
       var confirmationModal = document.getElementById("confirmationModal");
        confirmationModal.style.display = "block";
      
        // Get the second modal and form elements
        var secondModal = document.getElementById("secondModal");
        var personalKeyInput = document.getElementById("personalKeyInput");
      
      //   Add event listener to the confirm button
        var confirmBtn = document.getElementById("confirmBtn");
        confirmBtn.addEventListener("click", function() {
          // Show the second modal when the user clicks "Yes"
          confirmationModal.style.display = "none"; // Hide the first modal
          secondModal.style.display = "block"; // Show the second modal
        });
      
        // Add event listener to the cancel button of the second modal
        var cancelBtn = document.getElementById("cancelBtn");
        cancelBtn.addEventListener("click", function() {
          // Close the second modal and show the first modal again
          secondModal.style.display = "none"; // Hide the second modal
          confirmationModal.style.display = "block"; // Show the first modal
      
          // Perform AJAX request to another file
          $.ajax({
            url: "../includes/delete_transaction", // Replace with the actual path to your file
            type: "POST",
            data: {
              cancel: true,
              ran: ranValue // Pass the value of $ran in the AJAX request
            },
            success: function(response) {
              // Handle the response from the file
              if (response === "cancel_modal") {
              confirmationModal.style.display = "none"; // Hide the first modal
            }
            },
            error: function(xhr, status, error) {
              // Handle any errors that occur during the AJAX request
              console.error(error);
            }
          });
        });
      
        // Handle form submission
        var form = document.getElementById("personalKeyForm");
        form.addEventListener("submit", function(event) {
          event.preventDefault(); // Prevent form submission
      
          // Get the value entered by the user
          var personalKey = personalKeyInput.value;
      
          $.ajax({
          url: "../includes/confirm_trans", // Replace with the actual path to your other PHP file
          type: "POST",
          data: {
            personalKey: personalKey, // Pass the input value
            userId: <?php echo $f1;?> // Pass the user ID from PHP
          },
          success: function(response) {
            // Handle the response from the file
            console.log(response);
            $('#error').html(response);
      
          },
          error: function(xhr, status, error) {
            // Handle any errors that occur during the AJAX request
            console.error(error);
          }
        });
        });
      
          </script>
        <?php } else {
            echo base64_decode('Y291bGQgbm90IGluc2VydA==');
        }
                                                        } else {
                                                            if($k30 == base64_decode('NA==')) {
                                                                $h12 = $w11[base64_decode('YmFsYW5jZQ==')];
                                                                $l13 = $w11[base64_decode('Zm5hbWU=')];
                                                                $q14 = $w11[base64_decode('bWlkZGxlbmFtZQ==')];
                                                                $d15 = $w11[base64_decode('bG5hbWU=')];
                                                                $m16 = $l13.base64_decode('IA==').$q14.base64_decode('IA==').$d15;
                                                                $a21 = $w11[base64_decode('YmFsYW5jZQ==')];
                                                                $y22 = $w11[base64_decode('YWNjb3VudF9udW1iZXI=')];
                                                                $h23 = $w11[base64_decode('aWQ=')];
                                                                $e24 = new dbh();
                                                                $d25 = $e24->connect();
                                                                $h7 = random_alphanumericstrings(36);
                                                                $n8 = Date(base64_decode('ZC1tLVkgaDppOnMgYQ=='), time());
                                                                $d9 = base64_decode('ZGViaXQ=');
                                                                $t10 = base64_decode('QXBwcm92ZWQ=');
                                                                $z26 = base64_decode('TG9jYWwgVHJhbnNmZXI=');
                                                                $z27 = "INSERT INTO `on`(amount, recipient_acc,  sender_acc, sender_id, date_of_trans, recipient_name,  bank_accbal, type_of, trans_des, from_, status, trans_id, debit_type)VALUES('$j4', '$g2', '$y22', '$h23', '$n8', '$f3',  '$a21', '$d9', '$m5', '$m16', '$t10', '$h7', '$z26')";
                                                                $b28 = $d25->prepare($z27);
                                                                $b20 = $b28->execute();
                                                                if($b20) {?>
            <script>
                 var ranValue = "<?php echo $h7;?>";
         // Show the confirmation modal
         var confirmationModal = document.getElementById("confirmationModal");
          confirmationModal.style.display = "block";
        
          // Get the second modal and form elements
          var secondModal = document.getElementById("secondModal");
          var personalKeyInput = document.getElementById("personalKeyInput");
        
        //   Add event listener to the confirm button
          var confirmBtn = document.getElementById("confirmBtn");
          confirmBtn.addEventListener("click", function() {
            // Show the second modal when the user clicks "Yes"
            confirmationModal.style.display = "none"; // Hide the first modal
            secondModal.style.display = "block"; // Show the second modal
          });
        
          // Add event listener to the cancel button of the second modal
          var cancelBtn = document.getElementById("cancelBtn");
          cancelBtn.addEventListener("click", function() {
            // Close the second modal and show the first modal again
            secondModal.style.display = "none"; // Hide the second modal
            confirmationModal.style.display = "block"; // Show the first modal
        
            // Perform AJAX request to another file
            $.ajax({
              url: "../includes/delete_transaction", // Replace with the actual path to your file
              type: "POST",
              data: {
                cancel: true,
                ran: ranValue // Pass the value of $ran in the AJAX request
              },
              success: function(response) {
                // Handle the response from the file
                if (response === "cancel_modal") {
                confirmationModal.style.display = "none"; // Hide the first modal
              }
              },
              error: function(xhr, status, error) {
                // Handle any errors that occur during the AJAX request
                console.error(error);
              }
            });
          });
        
          // Handle form submission
          var form = document.getElementById("personalKeyForm");
          form.addEventListener("submit", function(event) {
            event.preventDefault(); // Prevent form submission
        
            // Get the value entered by the user
            var personalKey = personalKeyInput.value;
        
            $.ajax({
            url: "../includes/confirm_trans", // Replace with the actual path to your other PHP file
            type: "POST",
            data: {
              personalKey: personalKey, // Pass the input value
              userId: <?php echo $f1;?> // Pass the user ID from PHP
            },
            success: function(response) {
              // Handle the response from the file
              console.log(response);
              $('#error').html(response);
        
            },
            error: function(xhr, status, error) {
              // Handle any errors that occur during the AJAX request
              console.error(error);
            }
          });
          });
        
            </script>
          <?php } else {
              echo base64_decode('Y291bGQgbm90IGluc2VydA==');
          }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
