From eb70aba4303e0f37f120fed5de4328cc61d23c37 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Fri, 1 Nov 2024 17:49:48 -0400 Subject: [PATCH] Also fix the credential tagging in client asset details page --- client_asset_details.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/client_asset_details.php b/client_asset_details.php index 7f1f6c390..daeed5ff8 100644 --- a/client_asset_details.php +++ b/client_asset_details.php @@ -117,8 +117,11 @@ // Related Logins Query $sql_related_logins = mysqli_query($mysqli, "SELECT * FROM logins + LEFT JOIN login_tags ON login_tags.login_id = logins.login_id + LEFT JOIN tags ON tags.tag_id = login_tags.tag_id WHERE login_asset_id = $asset_id AND login_archived_at IS NULL + GROUP BY logins.login_id ORDER BY login_name DESC" ); $login_count = mysqli_num_rows($sql_related_logins); @@ -410,6 +413,28 @@ $login_asset_id = intval($row['login_asset_id']); $login_software_id = intval($row['login_software_id']); + // Tags + $login_tag_name_display_array = array(); + $login_tag_id_array = array(); + $sql_login_tags = mysqli_query($mysqli, "SELECT * FROM login_tags LEFT JOIN tags ON login_tags.tag_id = tags.tag_id WHERE login_id = $login_id ORDER BY tag_name ASC"); + while ($row = mysqli_fetch_array($sql_login_tags)) { + + $login_tag_id = intval($row['tag_id']); + $login_tag_name = nullable_htmlentities($row['tag_name']); + $login_tag_color = nullable_htmlentities($row['tag_color']); + if (empty($login_tag_color)) { + $login_tag_color = "dark"; + } + $login_tag_icon = nullable_htmlentities($row['tag_icon']); + if (empty($login_tag_icon)) { + $login_tag_icon = "tag"; + } + + $login_tag_id_array[] = $login_tag_id; + $login_tag_name_display_array[] = "$login_tag_name"; + } + $login_tags_display = implode('', $login_tag_name_display_array); + ?>