Improve inventory handling and cookie management:

- Replace old cookie logic with `Set_Cookie()` for enhanced security (SameSite, Secure, HttpOnly).
- Add dynamic AIX/Linux filtering on `/X/Inventory.php` with checkbox-driven UI and adjusted SQL queries.
- Expand `/X/Inventory.php` table with additional columns (`BES`, `FI`) and enhance data validation/styling.
- Add `decypher()` function in `Z_data_linux.php` to support OpenSSL-based file decryption with error handling.
This commit is contained in:
2025-10-14 11:08:42 +02:00
parent dcfe098f35
commit ea46ba5c8f
8 changed files with 569 additions and 241 deletions

View File

@@ -69,26 +69,14 @@
<div>
<?php
$aix = $linux = $dun = $azt = $other = "Checked";
$where = " and OS_TYPE IN (";
if (isset($_GET['AIX'])) {
if ($_GET['AIX'] == 1) {
$where .= "'AIX',";
} else {
$aix = "Unchecked";
}
} else {
$aix = "Unchecked";
}
if (isset($_GET['linux'])) {
if ($_GET['linux'] == 1) {
$where .= "'LINUX',";
} else {
$linux = "Unchecked";
}
} else {
$linux = "Unchecked";
}
$where = rtrim($where, ',') . ")";
$where = "";
if (!isset($_GET['AIX'])){$aix = "Unchecked";}
if (!isset($_GET['linux'])){$linux = "Unchecked";}
if($linux=="Unchecked" && $aix=="Unchecked"){ $where = " and 1=2 ";}
if($linux=="Unchecked" && $aix=="Checked"){ $where = " and Type ='AIX' ";}
if($linux=="Checked" && $aix=="Unchecked"){ $where = " and not Type ='AIX' ";}
$site = "";
if (isset($_GET['DUN'])) {
if ($_GET['DUN'] == 1) {
@@ -120,8 +108,9 @@
$site = " and (" . ltrim($site, ' or') . ") ";
$where .= $site;
$sql = "select hostname, os_type from srvall where decomtime is null and (ucase(filter) not like 'X_%' or filter is null) $where order by hostname";
$hosts = Invoke_aixcmdb($sql);
$sql = "select HOSTNAME, Type, OSVersion from x_srvall where Decom is null $where order by hostname";
$hosts = Invoke_Infra($sql);
//print_r($hosts);exit;
$taix = $aixok = $aixko = $tlinux = $linuxok = $linuxko = 0;
$resultsByHost = [];
@@ -178,6 +167,7 @@
<thead> <tr>
<th data-field='host' data-sortable='true'>Host</th>
<th data-field='OS' data-sortable='true'>OS</th>
<th data-field='OSVer' data-sortable='true'>Distrib</th>
<th data-field='TimeStamp' data-sortable='true'>TimeStamp</th>
<th data-field='RC' data-sortable='true'>RC</th>
<th data-field='Result' data-sortable='true'>StdOut</th>
@@ -186,7 +176,8 @@
<tbody> <?php
foreach ($hosts as $h) {
$host = strtoupper($h['HOSTNAME']);
$os = strtoupper($h['OS_TYPE']);
$os = strtoupper($h['Type']);
$osver = strtoupper($h['OSVersion']);
if ($os == "AIX") {
$taix++;
@@ -220,6 +211,7 @@
echo "<tr><td><b>$host</b></td>";
echo "<td>$os</td>";
echo "<td>$osver</td>";
echo "<td>" . $ts . "</td>";
if ($rc == 0 && (string)$rc <> "") {
echo "<td class='table-success'>" . $rc . "</td>";