<?php
    include'connection.php';
    
    if($_GET['bankHideId'])
    {
        $bankHideId=$_GET['bankHideId'];
        
        $quBankHide="SELECT * FROM bank WHERE Id='$bankHideId'";
        $reBankHide=mysqli_query($con,$quBankHide);
        $dataBankHide=mysqli_fetch_array($reBankHide);
        $adminStatus=$dataBankHide['Admin'];
        if($adminStatus=="SHOW")
        {
            $update="UPDATE bank SET Admin='HIDE' WHERE Id='$bankHideId'";
        }
        else
        {
            $update="UPDATE bank SET Admin='SHOW' WHERE Id='$bankHideId'";
        }
        if(mysqli_query($con,$update))
        {
            header('location:bank_details.php');
        }
    }
    
    if($_GET['bankActId'])
    {
        $bankActId=$_GET['bankActId'];
        
        $quBankHide="SELECT * FROM bank WHERE Id='$bankActId'";
        $reBankHide=mysqli_query($con,$quBankHide);
        $dataBankHide=mysqli_fetch_array($reBankHide);
        $bankStatus=$dataBankHide['Status'];
        if($bankStatus=="Active")
        {
            $update="UPDATE bank SET Status='Deactive', Admin='HIDE' WHERE Id='$bankActId'";
        }
        else
        {
            $update="UPDATE bank SET Status='Active', Admin='SHOW' WHERE Id='$bankActId'";
        }
        if(mysqli_query($con,$update))
        {
            header('location:bank_details.php');
        }
    }
    
    if($_GET['msgId'])
    {
        $msgId=$_GET['msgId'];
        
        $deleteMsg="DELETE FROM messege WHERE Id='$msgId'";
        if(mysqli_query($con,$deleteMsg))
        {
            header('location:add_alert_msg.php');
        }
    }
    
    if($_GET['RBBAId'])
    {
        $RBBAId=$_GET['RBBAId'];
        
        $deleteMsg="DELETE FROM RBBA WHERE Id='$RBBAId'";
        if(mysqli_query($con,$deleteMsg))
        {
            header('location:add_block_amount_rech.php');
        }
    }
    
    if($_GET['lapuId'])
    {
        $lapuId = $_GET['lapuId'];
        $lapuNo = $_GET['lapuNo'];
        
        $balNil="UPDATE myapi SET LapuBal='0' WHERE Id='$lapuId'";
        if(mysqli_query($con,$balNil))
        {
            $balNil2="UPDATE recharge SET ApiBal='0' WHERE LapuNo='$lapuNo' AND Status='SUCCESS' ORDER BY ID DESC LIMIT 1";
            if(mysqli_query($con,$balNil2))
            {
                header('location:Lapu_List.php');
            }
        }
    }
    
    if($_GET['deactiveId'])
    {
        $deactiveId=$_GET['deactiveId'];
        $update="UPDATE recharge SET ActiveMinus='1' WHERE Id='$deactiveId'";
        if(mysqli_query($con,$update))
        {
            header('location:minus_amount.php');
        }
    }
    
    if($_GET['lockId'])
    {
        $lockId=$_GET['lockId'];
        
        $qu="SELECT DiffLock FROM recharge WHERE Id='$lockId'";
        $re=mysqli_query($con,$qu);
        $data=mysqli_fetch_array($re);
        $lockStatus=$data['DiffLock'];
        
        if($lockStatus=="UNLOCK")
        {
            $update="UPDATE recharge SET DiffLock='LOCK' WHERE Id='$lockId'";
        }
        else
        {
            $update="UPDATE recharge SET DiffLock='UNLOCK' WHERE Id='$lockId'";
        }
        if(mysqli_query($con,$update))
        {
            header('location:minus_amount.php');
        }
    }
    
    

?>