<?php 	include_once('../../config.php');   	
		include_once(ABS_PATH.'/admin/login_check.php');    
		
		
		
		     
		    if(isset($_POST['update']))
            {  	 
                       
                			$_POST['cuurentId'] =  $_POST['cuurentId'];
                			$_POST['AMMT']  = $_POST['AMMT']; 
                                			       
                            $_SESSIONuserId =  "DP630936";
                            $_POST['cuurentId'] = trim($_POST['cuurentId']);        
                            $stmt=$conn->prepare("select  *   from UI__Rgst where cuurentId =:cuurentId ");   
                            $stmt->bindValue(':cuurentId', $_POST['cuurentId'] , PDO::PARAM_STR);  
                            $stmt->execute(); 
                            $affected_rows_UI__DChstr = $stmt->rowCount();  
                            $FResult = $stmt->fetch(PDO::FETCH_OBJ);  
                            $tNAM = $FResult->nm;
                            $tId = $_POST['cuurentId'];
                            $tPhm  = $FResult->phm;
                               
                            $data['Data'] =  $_POST['AMMT'];  
                            $stmt=$conn->prepare("select  availableFund  from  UI__Fundtransfer   where userid=:cuurentId order by id desc");  
                            $stmt->bindValue(':cuurentId', $_SESSIONuserId  , PDO::PARAM_STR);
                            $stmt->execute();  
                            $AllUsers = $stmt->fetch(PDO::FETCH_OBJ); 
                            $availableFund = 0;
                             
                            
                            $AllUsersT = GetBalance($_SESSIONuserId); 
                            
                          
                            if($AllUsersT>=$data['Data']) 
                            {
                                $availableFund = 1;    
                                $totalAvaib = $AllUsers->availableFund;
                            }    
                            
                            $stmt=$conn->prepare("select id from UI__Rgst  where  cuurentId=:cuurentId  ");   
                            $stmt->bindValue(':cuurentId',  $_SESSIONuserId , PDO::PARAM_STR);  
                            $stmt->execute();
                            $UI__Rgst = $stmt->fetch(PDO::FETCH_OBJ);   
                            
                            $stmt =  $conn->prepare("select *  from  _pkCc__  where  Uxd=:Uxd ");   
                            $stmt->bindValue(':Uxd', $UI__Rgst->id, PDO::PARAM_STR);
                            $stmt->execute(); 
                            $RstUxd = $stmt->fetch(PDO::FETCH_OBJ);
                            $PAYWAllet =  GetBalance(); 
                            $verify = password_verify($AllUsersT, $RstUxd->bl1); 
                            
                                 
                            if( ($AllUsersT >= $data['Data'])  && ($data['Data']>=100) && ($affected_rows_UI__DChstr>0) )
                            {    
                                 
                                $Result = $stmt->fetch(PDO::FETCH_OBJ);    
                                
                                     
                                $PlanAMt = $data['Data'] ;    
                                $stmt=$conn->prepare("select refId,custId,nm   from UI__Rgst where cuurentId =:cuurentId ");   
                                $stmt->bindValue(':cuurentId', $_POST['cuurentId'] , PDO::PARAM_INT);  
                                $stmt->execute(); 
                                 
                                  
                               
                                if($stmt->rowCount() > 0)
                                {     
                                    $Result = $stmt->fetch(PDO::FETCH_OBJ);   
                                    $userNm = $Result->nm;
                                    $CC = $Result->refId;
                                    $MyCust =  $Result->custId;
                                    $ard[] = $CC;
                                    for($i=0;$i<=9;$i++)
                                    {
                                        $stmt=$conn->prepare("select refId from UI__Rgst where cuurentId =:cuurentId ");   
                                        $stmt->bindValue(':cuurentId',$CC, PDO::PARAM_INT);  
                                        $stmt->execute();  
                                        if($stmt->rowCount() > 0)
                                        { 
                                            $Result = $stmt->fetch(PDO::FETCH_OBJ);   
                                            $CC = $Result->refId;
                                            $ard[] = $CC;
                                        }
                                    }  
                                }   
                                   
                                function Refcall($ref)
                                {
                                    global $conn;
                                    $stmt=$conn->prepare("select cuurentId   from UI__Rgst where refId =:cuurentId ");   
                                    $stmt->bindValue(':cuurentId', $ref , PDO::PARAM_INT);  
                                    $stmt->execute(); 
                                    $Result = $stmt->fetchAll(PDO::FETCH_OBJ);   
                                    return $Result;
                                }          
                				 
                                $totalAvaib -= $data['Data'];  
                                $stmt=$conn->prepare("insert into  UI__Fundtransfer (userid,Tdate,amt,availableFund,topUpId) values(:userid,:Tdate,:amt,:availableFund,:topUpId)    "); 
                                $stmt->bindValue(':userid', $_SESSIONuserId , PDO::PARAM_STR); 
                                $stmt->bindValue(':Tdate',date("d-M-Y H:i"), PDO::PARAM_STR); 
                                $stmt->bindValue(':amt',$data['Data'], PDO::PARAM_STR);  
                                $stmt->bindValue(':availableFund', $totalAvaib , PDO::PARAM_STR);  
                                $stmt->bindValue(':topUpId', $_POST['cuurentId'] , PDO::PARAM_STR);    
                                $stmt->execute();  
                                
                                $CoinVal = ($data['Data']);    
                                $stmt=$conn->prepare("insert into  UI__DChstr (typ,amt,Tdate,Rid,sId,percet,coin,byId,dys) values(:typ,:amt,:Tdate,:Rid,:sId,:percet,:coin,:byId,:dys) ");   
                                $stmt->bindValue(':typ', 1, PDO::PARAM_INT); 
                                $stmt->bindValue(':amt', $data['Data'], PDO::PARAM_INT); 
                                $stmt->bindValue(':Tdate', date("d-M-Y H:i:s") , PDO::PARAM_STR); 
                                $stmt->bindValue(':Rid', $_POST['cuurentId']  , PDO::PARAM_STR);
                                $stmt->bindValue(':sId', $MyCust  , PDO::PARAM_STR);
                                $stmt->bindValue(':percet', 0  , PDO::PARAM_STR);  
                                $stmt->bindValue(':coin', 1  , PDO::PARAM_STR);   
                                $stmt->bindValue(':byId', $_SESSIONuserId  , PDO::PARAM_STR);    
                                $stmt->bindValue(':dys', $_POST['dys']  , PDO::PARAM_STR);    
                                $stmt->execute();   
                                     
                				 
                				$stmt=$conn->prepare("select refId,custId   from UI__Rgst where cuurentId =:cuurentId ");   
                                $stmt->bindValue(':cuurentId', $_POST['cuurentId'] , PDO::PARAM_INT);  
                                $stmt->execute(); 
                				$Dref = $stmt->fetch(PDO::FETCH_OBJ);   
                			 
                				$stmt=$conn->prepare("select  custId from UI__Rgst where cuurentId =:cuurentId ");   
                                $stmt->bindValue(':cuurentId', $Dref->refId , PDO::PARAM_INT);  
                                $stmt->execute(); 
                				$MdRef = $stmt->fetch(PDO::FETCH_OBJ);    
                				 
                                LvBal($_SESSIONuserId,$_POST['AMMT'],2,"TopUp",$userNm." (".$_POST['cuurentId'].")");  
                                                     
                            	
                				$stmt=$conn->prepare("select  id from  UI__DChstr order by id desc  ");    
                				$stmt->execute();  
                				$UI__DChstrId = $stmt->fetch(PDO::FETCH_OBJ);
                				$DSCId = $UI__DChstrId->id;
                				 
                				
                				 if(end($ard)==0)
                                 {  
                                     
                                                    
                                    for($j1=0;$j1<(count($ard)-1);$j1++)
                                    {
                                        if($j1==0)
                                        {       
                                            
                                            
                                                    
                                                $CoinVal = ($data['Data']*0.1)/100;    
                                                $stmt=$conn->prepare("select id from UI__DChstr where Rid=:Rid and typ=1 and status=0 ");   
                                                $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR);   
                                                $stmt->execute();  
                                                
                                                
                 					                
                                                if($stmt->rowCount() > 0) 
                                                {    
                                                    $stmt=$conn->prepare("insert into  UI__Bns (Rid,Brid,Tdate,Tamt,BAmt,level,DaysLeft) values(:Rid,:Brid,:Tdate,:Tamt,:BAmt,:level,:DaysLeft) ");   
                                                    $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR); 
                                                    $stmt->bindValue(':Brid', $_POST['cuurentId'], PDO::PARAM_STR); 
                                                    $stmt->bindValue(':Tdate', date("d-M-Y") , PDO::PARAM_STR); 
                                                    $stmt->bindValue(':Tamt', $CoinVal , PDO::PARAM_STR);   
                                                    $stmt->bindValue(':BAmt', $data['Data'] , PDO::PARAM_STR);      
                                                    $stmt->bindValue(':level', 1  , PDO::PARAM_STR);       
                                                    $stmt->bindValue(':DaysLeft', 29  , PDO::PARAM_STR);   
                                                    $stmt->execute();   
                                                    
                                                    $stmt=$conn->prepare("select  * from  UI__Rgst where cuurentId=:cuurentId  ");   
                                                    $stmt->bindValue(':cuurentId',  $ard[$j1] , PDO::PARAM_STR);   
                                                    $stmt->execute();  
                                                    $custId = $stmt->fetch(PDO::FETCH_OBJ);
                                                    
                                                    
                                                    
                                                    
                                                    LvBal($ard[$j1],$CoinVal,1,"Level Balance",$_POST['cuurentId']);  
                                                    
                                                    $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                    $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                    $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                    $stmt->bindValue(':cct',1, PDO::PARAM_STR);  
                                                    $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                    $stmt->execute();
                                                    
                                                    }else
                                                    {
                                                    $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                    $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                    $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                    $stmt->bindValue(':cct',0, PDO::PARAM_STR);  
                                                    $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                    $stmt->execute();
                                                    }
                                        }
                                        else if($j1==1)
                                        { 
                                            $CoinVal = ($data['Data']*0.05)/100;    
                                            $stmt=$conn->prepare("select id from UI__DChstr where Rid=:Rid and typ=1  and status=0 ");   
                                            $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR);   
                                            $stmt->execute();  
                                            if($stmt->rowCount() > 0) 
                                            {
                                                $stmt=$conn->prepare("insert into  UI__Bns (Rid,Brid,Tdate,Tamt,BAmt,level,DaysLeft) values(:Rid,:Brid,:Tdate,:Tamt,:BAmt,:level,:DaysLeft) ");   
                                                $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Brid', $_POST['cuurentId'], PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tdate', date("d-M-Y") , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tamt', $CoinVal , PDO::PARAM_STR);   
                                                $stmt->bindValue(':BAmt', $data['Data'] , PDO::PARAM_STR);      
                                                $stmt->bindValue(':level', 2  , PDO::PARAM_STR);        
                                                $stmt->bindValue(':DaysLeft', 29  , PDO::PARAM_STR);   
                                                $stmt->execute();   
                                                
                                                $stmt=$conn->prepare("select  * from  UI__Rgst where cuurentId=:cuurentId  ");   
                                                $stmt->bindValue(':cuurentId',  $ard[$j1] , PDO::PARAM_STR);   
                                                $stmt->execute();  
                                                $custId = $stmt->fetch(PDO::FETCH_OBJ);
                                                
                                                LvBal($ard[$j1],$CoinVal,1,"Level Balance",$_POST['cuurentId']);  
                                                
                                                $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':cct',1, PDO::PARAM_STR);  
                                                $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                $stmt->execute();
                                                
                                                }else
                                                {
                                                $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':cct',0, PDO::PARAM_STR);  
                                                $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                $stmt->execute();
                                                }
                                             
                 					    }else if($j1==2)
                                        { 
                                            $CoinVal = ($data['Data']*(0.03))/100;   
                                            $stmt=$conn->prepare("select id from UI__DChstr where Rid=:Rid and typ=1  and status=0 ");   
                                            $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR);   
                                            $stmt->execute();  
                                            if($stmt->rowCount() > 0) 
                                            {
                                                $stmt=$conn->prepare("insert into  UI__Bns (Rid,Brid,Tdate,Tamt,BAmt,level,DaysLeft) values(:Rid,:Brid,:Tdate,:Tamt,:BAmt,:level,:DaysLeft) ");   
                                                $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Brid', $_POST['cuurentId'], PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tdate', date("d-M-Y") , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tamt', $CoinVal , PDO::PARAM_STR);   
                                                $stmt->bindValue(':BAmt', $data['Data'] , PDO::PARAM_STR);      
                                                $stmt->bindValue(':level', 3  , PDO::PARAM_STR);        
                                                $stmt->bindValue(':DaysLeft', 29  , PDO::PARAM_STR);   
                                                $stmt->execute();   
                                                
                                                $stmt=$conn->prepare("select  * from  UI__Rgst where cuurentId=:cuurentId  ");   
                                                $stmt->bindValue(':cuurentId',  $ard[$j1] , PDO::PARAM_STR);   
                                                $stmt->execute();  
                                                $custId = $stmt->fetch(PDO::FETCH_OBJ);
                                                
                                               LvBal($ard[$j1],$CoinVal,1,"Level Balance",$_POST['cuurentId']);  
                                               
                                                
                                                $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':cct',1, PDO::PARAM_STR);  
                                                $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                $stmt->execute();
                                                
                                            }else
                                            {
                                                $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':cct',0, PDO::PARAM_STR);  
                                                $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                $stmt->execute();
                                            }
                                             
                 					    }else if($j1==3)
                                        { 
                                            $CoinVal = ($data['Data']*(0.02))/100;       
                                            $stmt=$conn->prepare("select id from UI__DChstr where Rid=:Rid and typ=1  and status=0 ");   
                                            $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR);   
                                            $stmt->execute();  
                                            if($stmt->rowCount() > 0) 
                                            {
                                                $stmt=$conn->prepare("insert into  UI__Bns (Rid,Brid,Tdate,Tamt,BAmt,level,DaysLeft) values(:Rid,:Brid,:Tdate,:Tamt,:BAmt,:level,:DaysLeft) ");   
                                                $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Brid', $_POST['cuurentId'], PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tdate', date("d-M-Y") , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tamt', $CoinVal , PDO::PARAM_STR);   
                                                $stmt->bindValue(':BAmt', $data['Data'] , PDO::PARAM_STR);      
                                                $stmt->bindValue(':level', 4  , PDO::PARAM_STR);      
                                                $stmt->bindValue(':DaysLeft', 29  , PDO::PARAM_STR);   
                                                $stmt->execute();   
                                                
                                                $stmt=$conn->prepare("select  * from  UI__Rgst where cuurentId=:cuurentId  ");   
                                                $stmt->bindValue(':cuurentId',  $ard[$j1] , PDO::PARAM_STR);   
                                                $stmt->execute();  
                                                $custId = $stmt->fetch(PDO::FETCH_OBJ);
                                                
                                                LvBal($ard[$j1],$CoinVal,1,"Level Balance",$_POST['cuurentId']);  
                                                                
                                                     $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                    $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                    $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                    $stmt->bindValue(':cct',1, PDO::PARAM_STR);  
                                                    $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                    $stmt->execute();
                                                    
                                                }else
                                                {
                                                    $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                    $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                    $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                    $stmt->bindValue(':cct',0, PDO::PARAM_STR);  
                                                    $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                    $stmt->execute();
                                                }
                                             
                 					    }else if($j1==4)
                                        { 
                                            $CoinVal = ($data['Data']*(0.01))/100;     
                                            $stmt=$conn->prepare("select id from UI__DChstr where Rid=:Rid and typ=1 and status=0 ");   
                                            $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR);   
                                            $stmt->execute();  
                                            if($stmt->rowCount() > 0) 
                                            {
                                                $stmt=$conn->prepare("insert into  UI__Bns (Rid,Brid,Tdate,Tamt,BAmt,level,DaysLeft) values(:Rid,:Brid,:Tdate,:Tamt,:BAmt,:level,:DaysLeft) ");   
                                                $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Brid', $_POST['cuurentId'], PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tdate', date("d-M-Y") , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tamt', $CoinVal , PDO::PARAM_STR);   
                                                $stmt->bindValue(':BAmt', $data['Data'] , PDO::PARAM_STR);      
                                                $stmt->bindValue(':level', 5 , PDO::PARAM_STR);      
                                                $stmt->bindValue(':DaysLeft', 29  , PDO::PARAM_STR);   
                                                $stmt->execute();   
                                                
                                                $stmt=$conn->prepare("select  * from  UI__Rgst where cuurentId=:cuurentId  ");   
                                                $stmt->bindValue(':cuurentId',  $ard[$j1] , PDO::PARAM_STR);   
                                                $stmt->execute();  
                                                $custId = $stmt->fetch(PDO::FETCH_OBJ);
                                                
                                                LvBal($ard[$j1],$CoinVal,1,"Level Balance",$_POST['cuurentId']);  
                                                
                                                $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':cct',1, PDO::PARAM_STR);  
                                                $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                $stmt->execute();
                                                
                                                }else
                                                {
                                                $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':cct',0, PDO::PARAM_STR);  
                                                $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                $stmt->execute();
                                                }
                                                
                 					      }else if($j1==5)
                                        { 
                                            $CoinVal = ($data['Data']*(0.01))/100;     
                                            $stmt=$conn->prepare("select id from UI__DChstr where Rid=:Rid and typ=1 and status=0 ");   
                                            $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR);   
                                            $stmt->execute();  
                                            if($stmt->rowCount() > 0) 
                                            {
                                                $stmt=$conn->prepare("insert into  UI__Bns (Rid,Brid,Tdate,Tamt,BAmt,level,DaysLeft) values(:Rid,:Brid,:Tdate,:Tamt,:BAmt,:level,:DaysLeft) ");   
                                                $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Brid', $_POST['cuurentId'], PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tdate', date("d-M-Y") , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tamt', $CoinVal , PDO::PARAM_STR);   
                                                $stmt->bindValue(':BAmt', $data['Data'] , PDO::PARAM_STR);      
                                                $stmt->bindValue(':level', 6 , PDO::PARAM_STR);   
                                                $stmt->bindValue(':DaysLeft', 29  , PDO::PARAM_STR);   
                                                $stmt->execute();   
                                                
                                                $stmt=$conn->prepare("select  * from  UI__Rgst where cuurentId=:cuurentId  ");   
                                                $stmt->bindValue(':cuurentId',  $ard[$j1] , PDO::PARAM_STR);   
                                                $stmt->execute();  
                                                $custId = $stmt->fetch(PDO::FETCH_OBJ);
                                                
                                                LvBal($ard[$j1],$CoinVal,1,"Level Balance",$_POST['cuurentId']); 
                                                
                                                
                                                $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':cct',1, PDO::PARAM_STR);  
                                                $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                $stmt->execute();
                                                
                                                }else
                                                {
                                                $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':cct',0, PDO::PARAM_STR);  
                                                $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                $stmt->execute();
                                                }
                                             
                 					      }else if($j1==6)
                                        { 
                                            $CoinVal = ($data['Data']*(0.01))/100;     
                                            $stmt=$conn->prepare("select id from UI__DChstr where Rid=:Rid and typ=1 and status=0 ");   
                                            $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR);   
                                            $stmt->execute();  
                                            if($stmt->rowCount() > 0) 
                                            {
                                                $stmt=$conn->prepare("insert into  UI__Bns (Rid,Brid,Tdate,Tamt,BAmt,level,DaysLeft) values(:Rid,:Brid,:Tdate,:Tamt,:BAmt,:level,:DaysLeft) ");   
                                                $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Brid', $_POST['cuurentId'], PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tdate', date("d-M-Y") , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tamt', $CoinVal , PDO::PARAM_STR);   
                                                $stmt->bindValue(':BAmt', $data['Data'] , PDO::PARAM_STR);      
                                                $stmt->bindValue(':level', 7 , PDO::PARAM_STR);        
                                                $stmt->bindValue(':DaysLeft', 29  , PDO::PARAM_STR);   
                                                $stmt->execute();   
                                                
                                                $stmt=$conn->prepare("select  * from  UI__Rgst where cuurentId=:cuurentId  ");   
                                                $stmt->bindValue(':cuurentId',  $ard[$j1] , PDO::PARAM_STR);   
                                                $stmt->execute();  
                                                $custId = $stmt->fetch(PDO::FETCH_OBJ);
                                                
                                                 LvBal($ard[$j1],$CoinVal,1,"Level Balance",$_POST['cuurentId']);     
                                                 
                                                
                                                $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':cct',1, PDO::PARAM_STR);  
                                                $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                $stmt->execute();
                                                
                                                }else
                                                {
                                                $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':cct',0, PDO::PARAM_STR);  
                                                $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                $stmt->execute();
                                                }
                                             
                 					      }else if($j1==7)
                                        { 
                                            $CoinVal = ($data['Data']*(0.01))/100;     
                                            $stmt=$conn->prepare("select id from UI__DChstr where Rid=:Rid and typ=1 and status=0 ");   
                                            $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR);   
                                            $stmt->execute();  
                                            if($stmt->rowCount() > 0) 
                                            {
                                                $stmt=$conn->prepare("insert into  UI__Bns (Rid,Brid,Tdate,Tamt,BAmt,level,DaysLeft) values(:Rid,:Brid,:Tdate,:Tamt,:BAmt,:level,:DaysLeft) ");   
                                                $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Brid', $_POST['cuurentId'], PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tdate', date("d-M-Y") , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tamt', $CoinVal , PDO::PARAM_STR);   
                                                $stmt->bindValue(':BAmt', $data['Data'] , PDO::PARAM_STR);      
                                                $stmt->bindValue(':level', 8 , PDO::PARAM_STR);        
                                                $stmt->bindValue(':DaysLeft', 29  , PDO::PARAM_STR);   
                                                $stmt->execute();   
                                                
                                                $stmt=$conn->prepare("select  * from  UI__Rgst where cuurentId=:cuurentId  ");   
                                                $stmt->bindValue(':cuurentId',  $ard[$j1] , PDO::PARAM_STR);   
                                                $stmt->execute();  
                                                $custId = $stmt->fetch(PDO::FETCH_OBJ);
                                                
                                                LvBal($ard[$j1],$CoinVal,1,"Level Balance",$_POST['cuurentId']);   
                                                
                                                $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':cct',1, PDO::PARAM_STR);  
                                                $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                $stmt->execute();
                                                
                                                }else
                                                {
                                                $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':cct',0, PDO::PARAM_STR);  
                                                $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                $stmt->execute();
                                                }
                                             
                 					      }else if($j1==8)
                                        { 
                                            $CoinVal = ($data['Data']*(0.005))/100;     
                                            $stmt=$conn->prepare("select id from UI__DChstr where Rid=:Rid and typ=1 and status=0 ");   
                                            $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR);   
                                            $stmt->execute();  
                                            if($stmt->rowCount() > 0) 
                                            {
                                                $stmt=$conn->prepare("insert into  UI__Bns (Rid,Brid,Tdate,Tamt,BAmt,level,DaysLeft) values(:Rid,:Brid,:Tdate,:Tamt,:BAmt,:level,:DaysLeft) ");   
                                                $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Brid', $_POST['cuurentId'], PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tdate', date("d-M-Y") , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tamt', $CoinVal , PDO::PARAM_STR);   
                                                $stmt->bindValue(':BAmt', $data['Data'] , PDO::PARAM_STR);      
                                                $stmt->bindValue(':level', 9 , PDO::PARAM_STR);        
                                                $stmt->bindValue(':DaysLeft', 29  , PDO::PARAM_STR);   
                                                $stmt->execute();   
                                                
                                                $stmt=$conn->prepare("select  * from  UI__Rgst where cuurentId=:cuurentId  ");   
                                                $stmt->bindValue(':cuurentId',  $ard[$j1] , PDO::PARAM_STR);   
                                                $stmt->execute();  
                                                $custId = $stmt->fetch(PDO::FETCH_OBJ);
                                                
                                                LvBal($ard[$j1],$CoinVal,1,"Level Balance",$_POST['cuurentId']);  
                                                
                                                $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':cct',1, PDO::PARAM_STR);  
                                                $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                $stmt->execute();
                                                
                                                }else
                                                {
                                                $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':cct',0, PDO::PARAM_STR);  
                                                $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                $stmt->execute();
                                                }
                                             
                 					      }else if($j1==9)
                                        { 
                                            $CoinVal = ($data['Data']*(0.005))/100;     
                                            $stmt=$conn->prepare("select id from UI__DChstr where Rid=:Rid and typ=1 and status=0 ");   
                                            $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR);   
                                            $stmt->execute();  
                                            if($stmt->rowCount() > 0) 
                                            {
                                                $stmt=$conn->prepare("insert into  UI__Bns (Rid,Brid,Tdate,Tamt,BAmt,level,DaysLeft) values(:Rid,:Brid,:Tdate,:Tamt,:BAmt,:level,:DaysLeft) ");   
                                                $stmt->bindValue(':Rid', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Brid', $_POST['cuurentId'], PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tdate', date("d-M-Y") , PDO::PARAM_STR); 
                                                $stmt->bindValue(':Tamt', $CoinVal , PDO::PARAM_STR);   
                                                $stmt->bindValue(':BAmt', $data['Data'] , PDO::PARAM_STR);      
                                                $stmt->bindValue(':level', 10 , PDO::PARAM_STR);  
                                                $stmt->bindValue(':DaysLeft', 29  , PDO::PARAM_STR);   
                                                $stmt->execute();   
                                                
                                                $stmt=$conn->prepare("select  * from  UI__Rgst where cuurentId=:cuurentId  ");   
                                                $stmt->bindValue(':cuurentId',  $ard[$j1] , PDO::PARAM_STR);   
                                                $stmt->execute();  
                                                $custId = $stmt->fetch(PDO::FETCH_OBJ);
                                                
                                                LvBal($ard[$j1],$CoinVal,1,"Level Balance",$_POST['cuurentId']);  
                                                
                                                $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':cct',1, PDO::PARAM_STR);  
                                                $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                $stmt->execute();
                                                
                                                }else
                                                {
                                                $stmt=$conn->prepare("insert into  UI__LevlCt (tblId,custId,cct,bid) values(:tblId,:custId,:cct,:bid) "); 
                                                $stmt->bindValue(':tblId',$DSCId, PDO::PARAM_STR); 
                                                $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR); 
                                                $stmt->bindValue(':cct',0, PDO::PARAM_STR);  
                                                $stmt->bindValue(':bid', $_POST['cuurentId'], PDO::PARAM_STR);   
                                                $stmt->execute();
                                                }
             					      }
                 					      
                 					      
                 					        if($stmt->rowCount()>0) 
                 					        {
                 					      
                 					        $stmt=$conn->prepare("select * from UI__Rgst  where  cuurentId=:cuurentId  ");   
                                            $stmt->bindValue(':cuurentId',  $ard[$j1] , PDO::PARAM_STR);  
                                            $stmt->execute();
                                            $UI__Rgst = $stmt->fetch(PDO::FETCH_OBJ);      
                 					       
                                            $stmt=$conn->prepare("insert into UI__Receipt(type,bank,mobile,email,amountPaid,Tid,status,Tdate,custId,cdId,Topay,TopayName) values(:type,:bank,:mobile,:email,:amountPaid,:Tid,:status,:Tdate,:custId,:cdId,:Topay,:TopayName)"); 
                                            $stmt->bindValue(':type',   5 , PDO::PARAM_STR);   
                                            $stmt->bindValue(':bank',  "Level Balance" , PDO::PARAM_STR);   
                                            $stmt->bindValue(':mobile', $UI__Rgst->phm, PDO::PARAM_STR);
                                            $stmt->bindValue(':email', $UI__Rgst->eml , PDO::PARAM_STR); 
                                            $stmt->bindValue(':amountPaid', $CoinVal  , PDO::PARAM_STR); 
                                            $stmt->bindValue(':Tid', mt_rand(1234552,23555), PDO::PARAM_STR); 
                                            $stmt->bindValue(':status', 1 , PDO::PARAM_STR); 
                                            $stmt->bindValue(':Tdate', date("d-M-Y H:i") , PDO::PARAM_STR);      
                                            $stmt->bindValue(':custId', $ard[$j1] , PDO::PARAM_STR);  
                                            $stmt->bindValue(':cdId', $_SESSION['LastIntId']  , PDO::PARAM_STR); 
                                            $stmt->bindValue(':Topay',  $_POST['cuurentId'] , PDO::PARAM_STR); 
                                            $stmt->bindValue(':TopayName',  $_POST['cuurentId'] , PDO::PARAM_STR);     
                                            $stmt->execute();    
                                            unset($_SESSION['LastIntId']); 
                 					        } 
                                       }
                                 }	    
                                
                                
                                $Data = (($data['Data']*5)/100);  
                                $stmt=$conn->prepare("select  refId from UI__Rgst where cuurentId=:cuurentId  "); 
                                $stmt->bindValue(':cuurentId', $_POST['cuurentId']   , PDO::PARAM_STR);  
                                $stmt->execute();  
                                $refId = $stmt->fetch(PDO::FETCH_OBJ);
                                
                                  
                                $stmt=$conn->prepare("select  id from UI__DChstr where Rid=:cuurentId  and typ=1 "); 
                                $stmt->bindValue(':cuurentId',  $refId->refId  , PDO::PARAM_STR);  
                                $stmt->execute();  
                                if($stmt->rowCount() > 0)    
                				{
                				
                                 
                                $stmt=$conn->prepare("insert into  UI__Tpm (TopUpId,Amt,Tdate,RefTbl,custId) values(:TopUpId,:Amt,:Tdate,:RefTbl,:custId)"); 
                                $stmt->bindValue(':TopUpId', $refId->refId , PDO::PARAM_STR); 
                                $stmt->bindValue(':Amt', $Data , PDO::PARAM_STR); 
                                $stmt->bindValue(':Tdate', date("d-M-Y") , PDO::PARAM_STR);  
                                $stmt->bindValue(':RefTbl', $_POST['cuurentId'] , PDO::PARAM_STR);  
                                $stmt->bindValue(':custId', $_POST['cuurentId'] , PDO::PARAM_STR);    
                                $stmt->execute();   
                                  
                                LvBal($refId->refId,$Data,1,"Spot Balance",$_POST['cuurentId']);     
                                
                                $stmt=$conn->prepare("select * from UI__Rgst  where  cuurentId=:cuurentId  ");   
                                $stmt->bindValue(':cuurentId',  $refId->refId , PDO::PARAM_STR);  
                                $stmt->execute();
                                $UI__Rgst = $stmt->fetch(PDO::FETCH_OBJ);     	 
                
                                $stmt=$conn->prepare("insert into UI__Receipt(type,bank,mobile,email,amountPaid,Tid,status,Tdate,custId,cdId,Topay,TopayName) values(:type,:bank,:mobile,:email,:amountPaid,:Tid,:status,:Tdate,:custId,:cdId,:Topay,:TopayName)"); 
                                $stmt->bindValue(':type',   4 , PDO::PARAM_STR);   
                                $stmt->bindValue(':bank',  "Spot Balance" , PDO::PARAM_STR);   
                                $stmt->bindValue(':mobile', $UI__Rgst->phm, PDO::PARAM_STR);
                                $stmt->bindValue(':email', $UI__Rgst->eml , PDO::PARAM_STR); 
                                $stmt->bindValue(':amountPaid', $Data  , PDO::PARAM_STR); 
                                $stmt->bindValue(':Tid', mt_rand(1234552,23555), PDO::PARAM_STR); 
                                $stmt->bindValue(':status', 1 , PDO::PARAM_STR); 
                                $stmt->bindValue(':Tdate', date("d-M-Y H:i") , PDO::PARAM_STR);      
                                $stmt->bindValue(':custId', $_POST['cuurentId'], PDO::PARAM_STR);  
                                $stmt->bindValue(':cdId', $_SESSION['LastIntId']  , PDO::PARAM_STR); 
                                $stmt->bindValue(':Topay',  $refId->refId  , PDO::PARAM_STR); 
                                $stmt->bindValue(':TopayName',  $refId->refId , PDO::PARAM_STR);     
                                $stmt->execute();    
                                unset($_SESSION['LastIntId']);
                                
                
                				}
                            
                            $Tdt = date("d-M-Y", strtotime($dmt->Tdate));   
                            $amount = number_format((float)(($data['Data']*2)/$_POST['dys']), 2, '.', '');
                            $stmt=$conn->prepare("insert into UI__DailyROIGene(custId,amount,Tdate,TopUpdate) values(:custId,:amount,:Tdate,:TopUpdate)"); 
                            $stmt->bindValue(':custId',  $_POST['cuurentId'] , PDO::PARAM_INT);   
                            $stmt->bindValue(':amount', $amount , PDO::PARAM_INT);    
                            $stmt->bindValue(':Tdate',  date("d-M-Y") , PDO::PARAM_STR);   
                            $stmt->bindValue(':TopUpdate',  date("d-M-Y") , PDO::PARAM_STR);      
                            $stmt->execute();   
                            LvBal($_POST['cuurentId'],$amount,1,"Daily Balanace","NA");  
                                
                            
                            $stmt=$conn->prepare("select * from UI__Rgst  where  cuurentId=:cuurentId  ");   
                            $stmt->bindValue(':cuurentId',  $_POST['cuurentId'] , PDO::PARAM_STR);  
                            $stmt->execute();
                            $UI__Rgst = $stmt->fetch(PDO::FETCH_OBJ);     	
                            
            
                            $stmt=$conn->prepare("insert into UI__Receipt(type,bank,mobile,email,amountPaid,Tid,status,Tdate,custId,cdId,Topay,TopayName) values(:type,:bank,:mobile,:email,:amountPaid,:Tid,:status,:Tdate,:custId,:cdId,:Topay,:TopayName)"); 
                            $stmt->bindValue(':type',   3 , PDO::PARAM_STR);   
                            $stmt->bindValue(':bank',  "Daily Balance" , PDO::PARAM_STR);   
                            $stmt->bindValue(':mobile', $UI__Rgst->phm, PDO::PARAM_STR);
                            $stmt->bindValue(':email', $UI__Rgst->eml , PDO::PARAM_STR); 
                            $stmt->bindValue(':amountPaid', $amount  , PDO::PARAM_STR); 
                            $stmt->bindValue(':Tid', mt_rand(1234552,23555), PDO::PARAM_STR); 
                            $stmt->bindValue(':status', 1 , PDO::PARAM_STR); 
                            $stmt->bindValue(':Tdate', date("d-M-Y H:i") , PDO::PARAM_STR);      
                            $stmt->bindValue(':custId', $_POST['cuurentId'] , PDO::PARAM_STR);  
                            $stmt->bindValue(':cdId', $_SESSION['LastIntId']  , PDO::PARAM_STR); 
                            $stmt->bindValue(':Topay',  "NA" , PDO::PARAM_STR); 
                            $stmt->bindValue(':TopayName',  "NA"  , PDO::PARAM_STR);     
                            $stmt->execute();    
                            unset($_SESSION['LastIntId']);
                                
                            $stmt=$conn->prepare("insert into UI__TopWithDrw(custId,Tdate,status,type,amt) values(:custId,:Tdate,:status,:type,:amt)"); 
                            $stmt->bindValue(':custId',  $_POST['cuurentId'] , PDO::PARAM_STR);   
                            $stmt->bindValue(':Tdate',  date("d-M-Y") , PDO::PARAM_STR);   
                            $stmt->bindValue(':status', 0 , PDO::PARAM_INT);     
                            $stmt->bindValue(':type',  1 , PDO::PARAM_INT);
                            $stmt->bindValue(':amt', $data['Data'] , PDO::PARAM_STR);
                            $stmt->execute();        
                            
                            
                                            
                            $tNAM = $FResult->nm;
                            $tId = $_POST['cuurentId'];  
                            $CMB = '('.$tId.'),'.$tNAM;
                            $am = $_POST['AMMT'];
                            $mob = $tPhm;
                            $msg = urlencode('Dear '.$CMB.', Congratulations, your TOPUP amount Rs. '.$am.' has been successfully done, DailyPay team.'); 
                            $URL  = 'http://mobicomm.dove-sms.com//submitsms.jsp?user=DailyPAY&key=d92eabc025XX&mobile=+91'.$mob.'&message='.$msg.'&senderid=DAYPAY&accusage=1&entityid=1201169824017740929&tempid=1207169907140786246';
                            
                            
                            $crl = curl_init();
                            curl_setopt($crl, CURLOPT_URL, $URL);
                            curl_setopt($crl, CURLOPT_FRESH_CONNECT, true);
                            curl_setopt($crl, CURLOPT_RETURNTRANSFER, true); 
                            $response = curl_exec($crl);
                            
                            
                            $mob = '9762811448';
                            $msg = urlencode('Dear '.$CMB.', Congratulations, your TOPUP amount Rs. '.$am.' has been successfully done, DailyPay team.'); 
                            $URL  = 'http://mobicomm.dove-sms.com//submitsms.jsp?user=DailyPAY&key=d92eabc025XX&mobile=+91'.$mob.'&message='.$msg.'&senderid=DAYPAY&accusage=1&entityid=1201169824017740929&tempid=1207169907140786246';
                            
                            
                            $crl = curl_init();
                            curl_setopt($crl, CURLOPT_URL, $URL);
                            curl_setopt($crl, CURLOPT_FRESH_CONNECT, true);
                            curl_setopt($crl, CURLOPT_RETURNTRANSFER, true); 
                            $response = curl_exec($crl); 
                            
                    }
                    
					header("Location: userTopup.php");
					die;
            }       
?>  
<?php  include ABS_PATH.'/admin/header.php';	?>  

<script>
function hideFun()
{
    $("#update").hide();
}
function del_record(val)
{

	var r = confirm("Do you really want to delete record !");
	if (r == true) {    
	$.ajax({
	type: 'POST',
	url: "../ajax/default.php",
	//async: false,			 
	data: {del_city_names:1,val:val},	  
	success: function(ajaxresult){	     
		location.reload();	 	
	},
	error: function(XMLHttpRequest, textStatus, errorThrown) { 
	alert('Error');
	}
	});
	
	}	
	
}


 
        $(document).ready(function()
        {        
            var URL = "<?php echo ROOTPATH;?>";    
            $( "#cuurentId" ).change(function() 
            {       
                   
                       
              $.ajax({	
                    type: "POST",
                    url: URL+"/ajax/validation.php",
                    data: {userDatacheck:1,Data:$("#cuurentId").val()},
                    beforeSend: function(){ 
                    },
                    success: function(data)
                        {       
                            $("#AvailbleId").html("<span style='color:green;'>"+data+" &#x2713</span>");
                        }
                    });   
            });  
    });   

</script>
		 
		<div class="col-md-10">  
  			<div class="content-box-large">
  				<div class="panel-heading">
					<div class="panel-title"><h3>User Topup</h3></div>
					
					<div align="right">
					     
					</div>
					
				</div>
				
  				<div class="panel-body">
  					  
					    <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" id="product_frm" autocomplete="off"> 
								 
								 
							 
							     <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">UserId</label>
								    <div class="col-sm-3">
								      <input type="text" name="cuurentId"  id="cuurentId" class="form-control"  required/>
								      <span id="AvailbleId"></span>
								    </div>
								 </div>   
								 <hr>
								 
							 	 <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">Amount</label>
								    <div class="col-sm-3">
								      <input type="number" name="AMMT"  class="form-control" required />
								    </div>
								 </div>
								 <hr>
								 
								  <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">Days</label>
								    <div class="col-sm-3">
								      <input type="number" name="dys"  class="form-control" required />
								    </div>
								 </div>
								 <hr>
								  
								  
								  <div class="form-group">
										<label for="inputEmail3" class="col-sm-2 control-label">Update</label>
										<div class="col-sm-10">
										  <input type="submit"    class="btn btn-primary"  name="update" id="update" value="Topup"  onclick="hideFun()">
										</div>
								  </div>   
								</form>
					 	
								
								
  				</div>
  			</div>



		  </div>
		</div>
    </div>

<?php  include ABS_PATH.'/admin/footer.php';	?>    