<?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);
        
        $user = $inputdata['user'];
        
        
            $lob=$db->prepare('SELECT tbl_invoice.*, serveur.nom FROM tbl_invoice, serveur WHERE tbl_invoice.serveur=serveur.id AND tbl_invoice.paye=? AND tbl_invoice.id_point_journalier=(SELECT identifiant FROM point_journalier WHERE user=? AND ouverture=? AND fermeture=? ORDER BY id DESC LIMIT 1)');
            $lob->execute(array(0, $user, 1, 0));
            $image = $lob->fetchAll();
            echo(json_encode(['data' => $image]));
        
        
        
            
        