From a3a4dafaf5fbafa62766a574fd4c6eaca8750397 Mon Sep 17 00:00:00 2001 From: Marcus Hill Date: Mon, 2 Jan 2023 18:47:06 +0000 Subject: [PATCH] Add item name to shared file view logs --- guest_view_item.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/guest_view_item.php b/guest_view_item.php index dab808aa..adf29c7c 100644 --- a/guest_view_item.php +++ b/guest_view_item.php @@ -76,7 +76,8 @@ if($item_type == "Document"){ mysqli_query($mysqli, "UPDATE shared_items SET item_views = '$new_item_views' WHERE item_id = '$item_id'"); // Logging - mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Sharing', log_action = 'View', log_description = 'Viewed shared $item_type via link - Item ID: $item_id', log_client_id = '$client_id', log_created_at = NOW(), log_ip = '$ip', log_user_agent = '$user_agent', company_id = '1'"); + $name = mysqli_real_escape_string($mysqli, $doc_title); + mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Sharing', log_action = 'View', log_description = 'Viewed shared $item_type $name via link', log_client_id = '$client_id', log_created_at = NOW(), log_ip = '$ip', log_user_agent = '$user_agent', company_id = '1'"); }elseif($item_type == "File"){ $file_sql = mysqli_query($mysqli, "SELECT * FROM files WHERE file_id = '$item_related_id' AND file_client_id = '$client_id' LIMIT 1"); @@ -135,7 +136,8 @@ if($item_type == "Document"){ mysqli_query($mysqli, "UPDATE shared_items SET item_views = '$new_item_views' WHERE item_id = '$item_id'"); // Logging - mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Sharing', log_action = 'View', log_description = 'Viewed shared $item_type via link - Item ID: $item_id', log_client_id = '$client_id', log_created_at = NOW(), log_ip = '$ip', log_user_agent = '$user_agent', company_id = '1'"); + $name = mysqli_real_escape_string($mysqli, $login_name); + mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Sharing', log_action = 'View', log_description = 'Viewed shared $item_type $name via link', log_client_id = '$client_id', log_created_at = NOW(), log_ip = '$ip', log_user_agent = '$user_agent', company_id = '1'"); }