fixed Typos from plan.io ticket
All checks were successful
Build and Deploy Hugo Site / buildAndDeploy (push) Successful in 54s

This commit is contained in:
Andreas Hnida 2024-05-13 13:21:01 +02:00
commit 67a64b1bf8
7 changed files with 32 additions and 12 deletions

20
static/php/log.php Normal file
View file

@ -0,0 +1,20 @@
<?php
// Check if the request is a POST request
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Assuming data is sent via a POST field named 'logData'
$logData = $_POST['logData'] ?? 'Default log entry.';
// Specify the log file
$logfile = '../log.txt';
// Write or append the data to the file
file_put_contents($logfile, $logData . "\n", FILE_APPEND);
// Send a response back to JavaScript
echo json_encode(["status" => "success", "message" => "Data logged successfully"]);
} else {
// Handle incorrect request method
http_response_code(405);
echo json_encode(["status" => "error", "message" => "Method not allowed"]);
}
?>