<?php

    include('../db_conx.php');

    // now we will get the link...
    $user_view_id = $_GET['userID'];

    $doc_image = $_GET['file_name'];

    $path = "../principal/data/".$doc_image;

    echo $path;

    if(!unlink($path)) {
        echo "you have an error!";
    }else{
        echo "success document ";
    }

    // now we will update the database 
    $sql_kyc = "UPDATE clients SET passport_data = '' WHERE id = '$user_view_id'";
    $query_kyc = $db_conx->query($sql_kyc);

    if($query_kyc){
        echo 'success';
        header('location:../../principal/client_dashboard.php?DeleteKycStatus=true&userID='.$user_view_id);
    }else{
        echo 'failed';
    }

?>