Update add_entry.php

This commit is contained in:
jakani24
2024-01-21 16:57:08 +01:00
parent b20d2a1a13
commit 640965528f

View File

@@ -6,22 +6,23 @@
//this page has no gui, it may return ok or error //this page has no gui, it may return ok or error
if(!isset($_GET["loglevel"]) or !isset($_GET["logtext"]) or !isset($_GET["machine_id"])) if(!isset($_GET["loglevel"]) or !isset($_GET["logtext"]) or !isset($_GET["machine_id"]))
echo("syn_err"); echo("syn_err");
$loglevel=htmlspecialchars($_GET["loglevel"]); else{
$logtext=htmlspecialchars($_GET["logtext"]); $loglevel=htmlspecialchars($_GET["loglevel"]);
$machine_id=htmlspecialchars($_GET["machine_id"]); $logtext=htmlspecialchars($_GET["logtext"]);
//include db pw $machine_id=htmlspecialchars($_GET["machine_id"]);
include "../../../config.php"; //include db pw
$conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE); include "../../../config.php";
if ($conn->connect_error) { $conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE);
die("conn_err"); if ($conn->connect_error) {
die("conn_err");
}
$sql = "INSERT INTO log loglevel,machine_id,logtext VALUES (?,?,?);";
$stmt = $conn->prepare($sql);
$stmt->bind_param("sss", $$loglevel,$machine_id,$logtext);
// Execute the statement
if(!$stmt->execute())
echo("wrt_err");
$stmt->close();
$conn->close();
} }
$sql = "INSERT INTO log loglevel,machine_id,logtext VALUES (?,?,?);";
$stmt = $conn->prepare($sql);
$stmt->bind_param("sss", $$loglevel,$machine_id,$logtext);
// Execute the statement
if(!$stmt->execute())
echo("wrt_err");
$stmt->close();
$conn->close();
?> ?>