<?php
	include_once('../config.php');   
	include_once(ABS_PATH.'/custom_function/default.php');  
 
     
     
     
    if(isset($_POST['submitForm']))
    {   
                       
                if($_FILES['adharcard']['name']!='')
                {
                   
                    
                    unlink(ABS_PATH.'/uploads/fundReq/'.$_POST['adharcardhidden']);   
                    $ext = explode(".",$_FILES['adharcard']['name']);//explode file name from dot(.)   
                    $Fname =  substr(md5(uniqid()),26).".".end($ext);  
                    $target_path = ABS_PATH."/uploads/fundReq/".$Fname;//set the target path with a new name of image 
                    move_uploaded_file($_FILES['adharcard']['tmp_name'], $target_path); 
                }
                
                 if($_FILES['adhaback']['name']!='')
                {
                   
                    unlink(ABS_PATH.'/uploads/fundReq/'.$_POST['adharcardbackhidden']);   
                    $ext = explode(".",$_FILES['adhaback']['name']);//explode file name from dot(.)   
                    $Fname1 =  substr(md5(uniqid()),26).".".end($ext);  
                    $target_path = ABS_PATH."/uploads/fundReq/".$Fname1;//set the target path with a new name of image 
                    move_uploaded_file($_FILES['adhaback']['tmp_name'], $target_path); 
                }
            
              
                    $stmt=$conn->prepare("update  UI__Rgst set  adharcard=:adharcard,adhaback=:adhaback where cuurentId=:custId ");    
                    $stmt->bindValue(':custId', $_REQUEST['UserId'] , PDO::PARAM_STR);  
                    $stmt->bindValue(':adharcard', $Fname , PDO::PARAM_STR); 
                    $stmt->bindValue(':adhaback', $Fname1 , PDO::PARAM_STR); 
                    $stmt->execute();    
                    $_SESSION['Regis'] = "Documents Updated Successfully";
                    header("Location: kycUpload.php?UserId=".$_REQUEST['UserId']);  
                    die; 
    }         
     
     
        $stmt=$conn->prepare("select nm,cuurentId,adharcard,adhaback from UI__Rgst where cuurentId=:cuurentId");    
        $stmt->bindValue(':cuurentId', $_REQUEST['UserId'], PDO::PARAM_STR);  
        $stmt->execute();  
        $Result = $stmt->fetch(PDO::FETCH_OBJ);       
    
$_Refid = $_REQUEST['refId']; 
include_once("../view/registration/kycUpload.php");
?>