<?php

/* 
 * ROMAN DIGITAL - Autor: Américo Patetta
 */

set_include_path("../../");
include_once("server/class/Delivery.php");
@session_start();

$jsonParams = file_get_contents('php://input');
$paramObj = json_decode($jsonParams);

if(isset($paramObj->token) && isset($paramObj->userId)){
    $idDelivery=$paramObj->userId;
    $token=$paramObj->token;
    
    $delivery = new Delivery($idDelivery);
    if ($delivery->logout($token)){
        $ack['error'] = 0;
    } else {
        $ack['error'] = -2;
    }
} else {
    $ack['error'] = -1;
}

header('Content-Type: application/json; charset=utf-8');
echo json_encode($ack);