Add WeBuy license validation and usage logging API endpoints
- Add /api/license/webuy/ endpoint for license validation - Add /api/license/webuy/log/ endpoint for usage logging - Logs stored in /var/www/logs/webuy_usage.log 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
13
api/license/webuy/index.php
Normal file
13
api/license/webuy/index.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
header('Content-Type: text/plain');
|
||||
|
||||
// Simple validation - customize to your needs
|
||||
// Options: hardcoded, database lookup, check against allowed machine IDs, etc.
|
||||
|
||||
$valid = true; // Replace with your validation logic
|
||||
|
||||
if ($valid) {
|
||||
echo 'valid';
|
||||
} else {
|
||||
echo 'License expired or invalid.';
|
||||
}
|
||||
26
api/license/webuy/log/index.php
Normal file
26
api/license/webuy/log/index.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?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"}';
|
||||
Reference in New Issue
Block a user