Files

27 lines
610 B
PHP
Raw Permalink Normal View History

<?php
header('Content-Type: application/json');
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(405);
exit;
}
$input = json_decode(file_get_contents('php://input'), true);
if (!$input || empty($input['machineId']) || empty($input['timestamp'])) {
http_response_code(400);
exit;
}
$logEntry = sprintf(
"%s | %s | %s\n",
date('Y-m-d H:i:s'),
$input['machineId'],
$input['timestamp']
);
$logFile = __DIR__ . '/../../../../../logs/webuy_usage.log';
file_put_contents($logFile, $logEntry, FILE_APPEND | LOCK_EX);
http_response_code(200);
echo '{"status":"ok"}';