fixed Typos from plan.io ticket
All checks were successful
Build and Deploy Hugo Site / buildAndDeploy (push) Successful in 54s
All checks were successful
Build and Deploy Hugo Site / buildAndDeploy (push) Successful in 54s
This commit is contained in:
parent
72bdab6785
commit
67a64b1bf8
7 changed files with 32 additions and 12 deletions
20
static/php/log.php
Normal file
20
static/php/log.php
Normal 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"]);
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue