<?php
 function reset2($xp){
              
    // unset($_SESSION['trans_id']);
    unset($_SESSION['pay_amount']);
    unset($_SESSION['pay_network']);
    unset( $_SESSION['pay_curreny']);
    unset($_SESSION['pay_gate']);
    unset( $_SESSION['pay_wallet']);
    // unset( $_SESSION['pay_amount_usd']);
    unset($_SESSION['time_left']);  
    
        if($xp==1){
           unset($_SESSION['trans_id']);
            unset($_SESSION['pay_amount_usd']);
        }

}
    require 'singles.php';
        if($_POST['pay_status']){
            $trans_id = trim($_SESSION['trans_id']);
    $q = "select id from trans where trans_id='$trans_id' ORDER BY id DESC LIMIT 1";      
    $r = mysqli_query($conn,$q);
    $id = mysqli_R($r,0);
    
            $pay_status = trim(strtolower($_POST['pay_status']));
            // alert($pay_status);
            if($pay_status=='paid'){
$q="update trans set status ='pending' where id='$id' ";
$pay_msg = 'Deposit pending';
$state = 3;
reset2(2);
$_SESSION['deposit_success']=true;

            }else if($pay_status=='invalid'){
  
 $q="update trans set status ='cancel' where id='$id' ";
 $pay_msg = 'Deposit pending';
 $state = 2;
 reset2(1);

            }else if($pay_status=='cancel' || $pay_status=='canceled'){
$q="update trans set status ='canceled' where id='$id' ";
$pay_msg = 'Deposit Canceled';
$state = 2;
reset2(1);
            }else{
 $q="update trans set status ='canceled' where id='$id' ";
 $pay_msg = 'Deposit Canceled';
 $state = 2;
  reset2(1);
            }
         
           

            note_msg($pay_msg,'../deposit',$state);

        }
?>