<?php
session_start();
    header('Access-Control-Allow-Origin:*');
    header('Content-Type; application/json; charset=utf-8');
    header('Access-control-Allow-Method: POST');
    header('Access-control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-request-With');
    include('db.php');
        $inputdata = json_decode(file_get_contents("php://input"), true);
        
        $identifiant = $inputdata['identifiant'];
        $serveur = $inputdata['serveur'];
        
        $pub=$db->prepare('SELECT tbl_invoice.*, serveur.nom, serveur.id AS id_serveur FROM tbl_invoice, serveur WHERE serveur.id=tbl_invoice.serveur AND tbl_invoice.id_point_journalier=? AND tbl_invoice.serveur=?');
        $pub->execute(array($identifiant, $serveur));
        $image = $pub->fetchAll();    
        echo(json_encode(['data' => $image]));