From d5ad0e68572e52547cff3df669ebc193d7632435 Mon Sep 17 00:00:00 2001 From: jakani24 Date: Sat, 27 Apr 2024 13:05:09 +0200 Subject: [PATCH] Update view_log.php --- .../system/secure_zone/php/view_log.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/server/cyberhex-code/system/secure_zone/php/view_log.php b/src/server/cyberhex-code/system/secure_zone/php/view_log.php index 6fe06b4..0b93d88 100644 --- a/src/server/cyberhex-code/system/secure_zone/php/view_log.php +++ b/src/server/cyberhex-code/system/secure_zone/php/view_log.php @@ -25,8 +25,8 @@ $loglevel = htmlspecialchars(isset($_GET["loglevel"]) ? $_GET["loglevel"] : ""); $logtext = htmlspecialchars(isset($_GET["logtext"]) ? $_GET["logtext"] : ""); $machine_id = htmlspecialchars(isset($_GET["machine_id"]) ? $_GET["machine_id"] : ""); $time = htmlspecialchars(isset($_GET["time"]) ? $_GET["time"] : ""); -//$location = htmlspecialchars(isset($_GET["time"]) ? $_GET["time"] : ""); -$filter_query = "&loglevel=$loglevel&logtext=$logtext&machine_id=$machine_id&time=$time"; +$location = htmlspecialchars(isset($_GET["machine_location"]) ? $_GET["machine_location"] : ""); +$filter_query = "&loglevel=$loglevel&logtext=$logtext&machine_id=$machine_id&time=$time&machine_location=$machine_location"; include "../../../config.php"; //get data for pie chart @@ -182,13 +182,14 @@ $conn->close(); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } - $sql = "SELECT count(*) AS log_count FROM log WHERE loglevel LIKE ? AND logtext LIKE ? AND machine_id LIKE ? AND time LIKE ?"; + $sql = "SELECT count(*) AS log_count FROM log WHERE machine_location LIKE ? AND loglevel LIKE ? AND logtext LIKE ? AND machine_id LIKE ? AND time LIKE ?"; $stmt = $conn->prepare($sql); $loglevel = "%" . $loglevel . "%"; $logtext = "%" . $logtext . "%"; $machine_id = "%" . $machine_id . "%"; + $machine_location = "%" . $machine_location . "%"; $time = "%" . $time . "%"; - $stmt->bind_param("ssss", $loglevel, $logtext, $machine_id, $time); + $stmt->bind_param("sssss",$machine_location, $loglevel, $logtext, $machine_id, $time); $stmt->execute(); $result = $stmt->get_result(); $row = $result->fetch_assoc(); @@ -198,13 +199,13 @@ $conn->close(); $total_pages = ceil($total_entries / $page_size); // Query log entries for the current page with filters - $sql = "SELECT * FROM machines,log WHERE loglevel LIKE ? AND logtext LIKE ? AND machine_id LIKE ? AND time LIKE ? AND machine_name=machine_id ORDER BY log.id DESC LIMIT ?, ?"; + $sql = "SELECT * FROM machines,log WHERE machine_location LIKE ? AND loglevel LIKE ? AND logtext LIKE ? AND machine_id LIKE ? AND time LIKE ? AND machine_name=machine_id ORDER BY log.id DESC LIMIT ?, ?"; $stmt = $conn->prepare($sql); $loglevel = "%" . $loglevel . "%"; $logtext = "%" . $logtext . "%"; $machine_id = "%" . $machine_id . "%"; $time = "%" . $time . "%"; - $stmt->bind_param("ssssii", $loglevel, $logtext, $machine_id, $time, $offset, $page_size); + $stmt->bind_param("ssssii", $machine_location, $loglevel, $logtext, $machine_id, $time, $offset, $page_size); $stmt->execute(); $result = $stmt->get_result(); if($current_page==1){ @@ -228,7 +229,7 @@ $conn->close(); echo ''; echo ''; echo ''; - echo ''; + echo ''; echo ''; echo ''; echo '';