<?php
	include_once('../config.php');      
	include_once(ABS_PATH.'/custom_function/default.php'); 
	
	
    $stmt=$conn->prepare("select utilities from UI__Rgst    where cuurentId =:sId    ");   
    $stmt->bindValue(':sId',  $_SESSION['userId'] , PDO::PARAM_INT);  
    $stmt->execute(); 
    $user = $stmt->fetch(PDO::FETCH_OBJ);   

 

         
        if($user->utilities=="")
            $Bkn = 0;
        else{
            $expln =  explode(",",$user->utilities); 
            $Bkn = $expln[1];
        }   
        
    if( (!isset($_SESSION['userId'])) || ($Bkn!=1) )
    { 
         header("Location: ../");
         die;
    }   
     
    
                     
                    
              
    if(isset($_POST['submitAgent'])) 
    {     
        header("Location: P2PSERVICE3.php?amont=".$_POST['AMMT'].'&p2pAgent='.$_POST['p2pAgent']."&AgnetTxn=1&optType=1&bkTransfer=XXX");
        die; 
    }  
	
    $stmt=$conn->prepare("select * from  UI__Rgst where cuurentId=:cuurentId");    
    $stmt->bindValue(':cuurentId',  $_SESSION['userId'], PDO::PARAM_STR);     
    $stmt->execute(); 
    $Result = $stmt->fetch(PDO::FETCH_OBJ);      
    
    
        $stmt=$conn->prepare("select  charges from  UI__Deduction"); 
        $stmt->execute();
        $UI__Deduction = $stmt->fetch(PDO::FETCH_OBJ);  
        
        
     
            $stmt=$conn->prepare("select dailyMonthly  from UI__Rgst  where  cuurentId=:custId    ");   
            $stmt->bindValue(':custId',  $_SESSION['userId'] , PDO::PARAM_STR);  
            $stmt->execute(); 
            $dailyMonthly = $stmt->fetch(PDO::FETCH_OBJ); 
            
             
            if($dailyMonthly->dailyMonthly==1)
            {  
            $stmt=$conn->prepare("select * from UI__LastBal  where  custId=:custId    ");   
            $stmt->bindValue(':custId',  $_SESSION['userId'] , PDO::PARAM_STR);  
            $stmt->execute(); 
            $UI__LastBal = $stmt->fetch(PDO::FETCH_OBJ);
            $PAYWAllet = $UI__LastBal->LastBal;   
            }else
                $PAYWAllet =  GetBalance();  
                
        
     
        
        
        $stmt = $conn->prepare("SELECT upi,id,name FROM  UI__UPIVefy     where ById=:ById");   
        $stmt->bindValue(':ById',  $_SESSION['userId'] , PDO::PARAM_INT);  
        $stmt->execute(); 
        $UI__upi = $stmt->fetchAll(PDO::FETCH_OBJ); 
        
        
        
                 
        $stmt=$conn->prepare("select   cuurentId  from   UI__Rgst   where  p2pLimit>$_REQUEST[amont] and p2p!='' and cuurentId!=:cuurentId  ");   
        $stmt->bindValue(':cuurentId',    $_SESSION['userId'] , PDO::PARAM_INT);  
        $stmt->execute(); 
        $p2pUsers = $stmt->fetchAll(PDO::FETCH_OBJ);     

       
        	

include_once("../view/dashboard/P2PSERVICE2.php");
?>