This commit is contained in:
jakani24
2024-04-27 13:12:59 +02:00
parent b55f983fc6
commit ab324dfbd3
2 changed files with 5 additions and 2 deletions

View File

@@ -69,11 +69,12 @@ $filter_query = "&loglevel=$loglevel&logtext=$logtext&machine_id=$machine_id&tim
$fp=fopen("/var/www/html/export/cyberhex_log_export.csv","w"); $fp=fopen("/var/www/html/export/cyberhex_log_export.csv","w");
//do all the logic here and write into file //do all the logic here and write into file
// Query log entries for the export file with filters // Query log entries for the export file with filters
$sql = "SELECT * FROM log WHERE loglevel LIKE ? AND logtext LIKE ? AND machine_id LIKE ? AND time LIKE ? ORDER BY id DESC"; $sql = "SELECT count(*) AS log_count FROM machines,log WHERE machine_location LIKE ? AND loglevel LIKE ? AND logtext LIKE ? AND machine_id LIKE ? AND time LIKE ?";
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$loglevel = "%" . $loglevel . "%"; $loglevel = "%" . $loglevel . "%";
$logtext = "%" . $logtext . "%"; $logtext = "%" . $logtext . "%";
$machine_id = "%" . $machine_id . "%"; $machine_id = "%" . $machine_id . "%";
$machine_location = "%" . $machine_location . "%";
$time = "%" . $time . "%"; $time = "%" . $time . "%";
$stmt->bind_param("ssss", $loglevel, $logtext, $machine_id, $time); $stmt->bind_param("ssss", $loglevel, $logtext, $machine_id, $time);
$stmt->execute(); $stmt->execute();
@@ -86,6 +87,7 @@ $filter_query = "&loglevel=$loglevel&logtext=$logtext&machine_id=$machine_id&tim
fwrite($fp,$row["loglevel"] . ';'); fwrite($fp,$row["loglevel"] . ';');
fwrite($fp,$row["logtext"] . ';'); fwrite($fp,$row["logtext"] . ';');
fwrite($fp,$row["machine_id"] . ';'); fwrite($fp,$row["machine_id"] . ';');
fwrite($fp,$row["machine_location"] . ';');
fwrite($fp,$row["time"] . ";\n"); fwrite($fp,$row["time"] . ";\n");
} }
fclose($fp); fclose($fp);

View File

@@ -17,7 +17,8 @@ $machine_id = htmlspecialchars(isset($_GET["machine_id"]) ? $_GET["machine_id"]
$path = htmlspecialchars(isset($_GET["path"]) ? $_GET["path"] : ""); $path = htmlspecialchars(isset($_GET["path"]) ? $_GET["path"] : "");
$hash = htmlspecialchars(isset($_GET["hash"]) ? $_GET["hash"] : ""); $hash = htmlspecialchars(isset($_GET["hash"]) ? $_GET["hash"] : "");
$action = htmlspecialchars(isset($_GET["action"]) ? $_GET["action"] : ""); $action = htmlspecialchars(isset($_GET["action"]) ? $_GET["action"] : "");
$filter_query = "&hash=$hash&path=$path&machine_id=$machine_id&action=$action"; $machine_location = htmlspecialchars(isset($_GET["machine_location"]) ? $_GET["machine_location"] : "");
$filter_query = "&hash=$hash&path=$path&machine_id=$machine_id&action=$action&machine_location=$machine_location";
?> ?>
<!DOCTYPE html> <!DOCTYPE html>