Ejemplo n.º 1
0
             $filtered_input = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
             //            echo $filtered_input["ime"];
             UsersDB::updateCustomer($filtered_input);
             $status = array('status' => 'OK');
             http_response_code(204);
             echo json_encode($status);
         } else {
             // error
             echo returnError(404, "Unknown request: [{$http_method} {$resource}]");
         }
     }
     break;
 case "cart":
     session_start();
     if ($http_method == "GET" && $param == null) {
         ApiUtils::getCartProducts();
     } else {
         if ($http_method == "POST" && $param != null) {
             ApiUtils::addInCart($param);
         } else {
             if ($http_method == "PUT" && $param != null) {
                 ApiUtils::editCart($param);
             } else {
                 if ($http_method == "DELETE" && $param != null) {
                     ApiUtils::removeFromCart($param);
                 } else {
                     // error
                     echo returnError(404, "Unknown request: [{$http_method} {$resource}]");
                 }
             }
         }