diff --git a/ajax/ajax_asset_details.php b/ajax/ajax_asset_details.php
index ec378459..4accc12d 100644
--- a/ajax/ajax_asset_details.php
+++ b/ajax/ajax_asset_details.php
@@ -300,10 +300,10 @@ ob_start();
-
+
-
+
diff --git a/ajax/ajax_credential_edit.php b/ajax/ajax_credential_edit.php
index ea132dfe..3b25b61e 100644
--- a/ajax/ajax_credential_edit.php
+++ b/ajax/ajax_credential_edit.php
@@ -12,6 +12,8 @@ $credential_name = nullable_htmlentities($row['credential_name']);
$credential_description = nullable_htmlentities($row['credential_description']);
$credential_uri = nullable_htmlentities($row['credential_uri']);
$credential_uri_2 = nullable_htmlentities($row['credential_uri_2']);
+$credential_uri_link = sanitize_url($row['credential_uri']);
+$credential_uri_2_link = sanitize_url($row['credential_uri_2']);
$credential_username = nullable_htmlentities(decryptCredentialEntry($row['credential_username']));
$credential_password = nullable_htmlentities(decryptCredentialEntry($row['credential_password']));
$credential_otp_secret = nullable_htmlentities($row['credential_otp_secret']);
@@ -137,7 +139,7 @@ ob_start();
@@ -153,7 +155,7 @@ ob_start();
-
@@ -267,148 +214,96 @@ ob_start();
0) { ?>
-
Vendors
-
- 0) {
+ echo "
Vendors";
+ mysqli_data_seek($sql_vendors, 0);
+ while ($row = mysqli_fetch_array($sql_vendors)) {
+ $vendor_id = intval($row['vendor_id']);
+ $vendor_name = nullable_htmlentities($row['vendor_name']);
+ echo "$vendor_name ";
+ }
+ echo " ";
}
?>
0) { ?>
-
Contacts
-
- 0) {
+ echo "
Contacts";
+ mysqli_data_seek($sql_contacts, 0);
+ while ($row = mysqli_fetch_array($sql_contacts)) {
+ $contact_id = intval($row['contact_id']);
+ $contact_name = nullable_htmlentities($row['contact_name']);
+ echo "$contact_name ";
+ }
+ echo " ";
}
?>
0 || mysqli_num_rows($sql_credentials) > 0) { ?>
-
Credentials
-
- $row[credential_name] ";
- }
+ if (mysqli_num_rows($sql_assets) > 0 || mysqli_num_rows($sql_credentials) > 0) {
+ echo " Credentials";
+ // Credentials linked to assets
+ mysqli_data_seek($sql_assets, 0);
+ while ($row = mysqli_fetch_array($sql_assets)) {
+ $credential_name = nullable_htmlentities($row['credential_name']);
+ if (!empty($credential_name)) {
+ echo "$credential_name ";
}
-
- // Showing explicitly linked credentials
- while ($row = mysqli_fetch_array($sql_credentials)) {
- if (!empty($row['credential_name'])) {
- echo "$row[credential_name] ";
- }
+ }
+ // Explicitly linked credentials
+ mysqli_data_seek($sql_credentials, 0);
+ while ($row = mysqli_fetch_array($sql_credentials)) {
+ $credential_name = nullable_htmlentities($row['credential_name']);
+ if (!empty($credential_name)) {
+ echo "$credential_name ";
}
- ?>
-
- ";
}
?>
- URLs
-
- $row[credential_uri] ";
- }
- }
-
- // Reset the $sql_assets pointer to the start
- mysqli_data_seek($sql_assets, 0);
-
- // Show URLs linked to assets, that also have credentials
- while ($row = mysqli_fetch_array($sql_assets)) {
- if (!empty($row['credential_uri'])) {
- echo "$row[credential_uri] ";
- }
- }
- ?>
-
- URLs";
+ foreach ($urls as $url) {
+ $label = htmlspecialchars(parse_url($url, PHP_URL_HOST) ?: $url);
+ echo "$label ";
+ }
+ echo " ";
}
?>
0) { ?>
- Documents
-
- 0) {
+ echo " Documents";
+ mysqli_data_seek($sql_docs, 0);
+ while ($row = mysqli_fetch_array($sql_docs)) {
+ $document_id = intval($row['document_id']);
+ $document_name = nullable_htmlentities($row['document_name']);
+ echo "$document_name ";
+ }
+ echo " ";
}
?>
-
-
-
-
-
@@ -416,3 +311,4 @@ ob_start();
diff --git a/asset_details.php b/asset_details.php
index 632c87b2..3e8deaf0 100644
--- a/asset_details.php
+++ b/asset_details.php
@@ -292,10 +292,10 @@ if (isset($_GET['asset_id'])) {
-
+
-
+
diff --git a/credentials.php b/credentials.php
index 5a88e058..bb74060b 100644
--- a/credentials.php
+++ b/credentials.php
@@ -300,13 +300,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
$credential_id = intval($row['c_credential_id']);
$credential_name = nullable_htmlentities($row['credential_name']);
$credential_description = nullable_htmlentities($row['credential_description']);
- $credential_uri = nullable_htmlentities($row['credential_uri']);
+ $credential_uri = sanitize_url($row['credential_uri']);
if (empty($credential_uri)) {
$credential_uri_display = "-";
} else {
- $credential_uri_display = truncate($credential_uri,40) . " ";
+ $credential_uri_display = "" . truncate($credential_uri,40) . " ";
}
- $credential_uri_2 = nullable_htmlentities($row['credential_uri_2']);
+ $credential_uri_2 = sanitize_url($row['credential_uri_2']);
$credential_username = nullable_htmlentities(decryptCredentialEntry($row['credential_username']));
if (empty($credential_username)) {
$credential_username_display = "-";