From 752326a58406cec2e63ad36eea45dc70c01840c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Sat, 10 Jun 2023 09:46:33 +0200 Subject: [PATCH] fix log --- admin/api.php | 12 ++++++++++-- admin/index.html | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/admin/api.php b/admin/api.php index 0242590..cae7399 100644 --- a/admin/api.php +++ b/admin/api.php @@ -69,8 +69,16 @@ if (!empty($action) && $_POST["password"] == $config["admin_pwd"]){ $stmt6->store_result(); } - if ($action == "getlog"&& !empty($_POST["id"])){ - $stmt7 = $mysqli->prepare("SELECT `ID`, `Action`, `LinkID`, `ContentID`, `Datetime`, `Timestamp`, `Nickname`, `IP` FROM Logs"); + if ($action == "getlog"){ + $idcko = $_POST["id"]; + if (empty($idcko)||$idcko == "*"){ + $query = "SELECT `ID`, `Action`, `LinkID`, `ContentID`, `Datetime`, `Timestamp`, `Nickname`, `IP` FROM Logs"; + $stmt7 = $mysqli->prepare($query); + } + else{ + $query = "SELECT `ID`, `Action`, `LinkID`, `ContentID`, `Datetime`, `Timestamp`, `Nickname`, `IP` FROM Logs WHERE `LinkID` = ?"; + $stmt7->bind_param("s", $idcko); + } $stmt7->bind_result ($rowidx, $actionx, $linkidx, $contentidx, $datetimex, $timestampx, $nicknamex, $ipx); $stmt7->execute(); $stmt7->store_result(); diff --git a/admin/index.html b/admin/index.html index 0e9e511..134528d 100644 --- a/admin/index.html +++ b/admin/index.html @@ -99,6 +99,7 @@ if (data == "OK"){ getlinks(); getcontents(); + getlog(); $("#pwdentry").fadeOut("slow", function(){ $("#indexmanagement").fadeIn("slow", function(){ }); @@ -179,7 +180,7 @@

Log manager:

-
+