Add DHCP management pages and update navigation
- Implemented `dhcp_servers.php` for listing DHCP servers with export and search functionalities. - Added `dhcp_detail.php` for detailed DHCP server configurations, including scopes and reservations. - Updated `navbar.html` to include a new "Network" section with DHCP navigation links. - Extended French and English translation files to support new DHCP-related terms.
This commit is contained in:
154
Network/dhcp_detail.php
Normal file
154
Network/dhcp_detail.php
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
<?php
|
||||||
|
include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php";
|
||||||
|
|
||||||
|
$server = $_GET['s'] ?? '';
|
||||||
|
$ts = date("Y-m-d");
|
||||||
|
|
||||||
|
$data = Invoke_Entry01("SELECT dump FROM dump_dhcp where ts ='$ts' and server = '$server'");
|
||||||
|
$xmlRaw = $data[0]['dump'] ?? '';
|
||||||
|
|
||||||
|
if (!$xmlRaw) {
|
||||||
|
die("Aucune donnée trouvée pour le serveur $server à la date $ts");
|
||||||
|
}
|
||||||
|
|
||||||
|
$xmlString = mb_convert_encoding($xmlRaw, 'UTF-8', 'ISO-8859-1');
|
||||||
|
if (!str_contains($xmlString, '<?xml')) {
|
||||||
|
$xmlString = '<?xml version="1.0" encoding="UTF-8"?>' . $xmlString;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$xml = new SimpleXMLElement($xmlString);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo "Erreur de parsing XML : " . $e->getMessage();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$definitions = [];
|
||||||
|
foreach ($xml->xpath("//OptionDefinition") as $optDef) {
|
||||||
|
$definitions[(string)$optDef->OptionId] = (string)$optDef->Name;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-t">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
|
||||||
|
<title>Web Infra Reports IT</title>
|
||||||
|
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
|
||||||
|
|
||||||
|
<script src="/js/jquery-3.6.1.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
||||||
|
<link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css">
|
||||||
|
<link rel="stylesheet" href="/css/preloader.css">
|
||||||
|
<script src="/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="/css/bootstrap-table.min.css">
|
||||||
|
<script src="/js/bootstrap-table.min.js"></script>
|
||||||
|
<script src="/js/bootstrap-table-fr-FR.min.js"></script>
|
||||||
|
<script src="/js/tableExport.min.js"></script>
|
||||||
|
<script src="/js/bootstrap-table-export.min.js"></script>
|
||||||
|
<script src="/js/libs/js-xlsx/xlsx.core.min.js"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="bg-light">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row flex-nowrap">
|
||||||
|
<div class="col-auto col-md-2 col-xl-2 px-sm-2 px-0 bg-dark vh-100 position-sticky top-0">
|
||||||
|
<?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col py-3">
|
||||||
|
<h1><span class="badge text-bg-dark w-100"><?php echo htmlspecialchars($server); ?></span></h1>
|
||||||
|
|
||||||
|
<div class="card mb-3">
|
||||||
|
<div class="card-header bg-info text-white">
|
||||||
|
<a class="text-white fw-bold" data-bs-toggle="collapse" href="#OptVal"><?php echo $w_globalOptionValues ; ?></a>
|
||||||
|
</div>
|
||||||
|
<div id="OptVal" class="collapse show">
|
||||||
|
<div class="card-body">
|
||||||
|
<?php
|
||||||
|
$globalOptions = $xml->xpath("//IPv4/OptionValues/OptionValue");
|
||||||
|
foreach ($globalOptions as $opt):
|
||||||
|
$idx = (string)$opt->OptionId;
|
||||||
|
$vals = [];
|
||||||
|
foreach ($opt->Value as $v) $vals[] = (string)$v;
|
||||||
|
?>
|
||||||
|
<div class="row row-option">
|
||||||
|
<div class="col-md-3"><strong><?php echo $idx; ?></strong> - <?php echo $definitions[$idx] ?? 'Unknown'; ?></div>
|
||||||
|
<div class="col-md-6"><?php echo implode(" ; ", $vals); ?></div>
|
||||||
|
<div class="col-md-3 text-muted small"><?php echo (string)$opt->VendorClass; ?></div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
foreach ($xml->xpath("//Scope") as $scope):
|
||||||
|
$scopeIdRaw = (string)$scope->ScopeId;
|
||||||
|
$cleanId = "scope_" . str_replace('.', '', $scopeIdRaw);
|
||||||
|
$scopeName = (string)$scope->Name;
|
||||||
|
?>
|
||||||
|
<div class="card mb-2">
|
||||||
|
<div class="card-header bg-success text-white">
|
||||||
|
<a class="text-white fw-bold" data-bs-toggle="collapse" href="#<?php echo $cleanId; ?>">
|
||||||
|
<?php echo "$scopeIdRaw ($scopeName)"; ?>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div id="<?php echo $cleanId; ?>" class="collapse">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row mb-3 text-center bg-light py-2">
|
||||||
|
<div class="col-md-4"><strong><?php echo $w_start; ?>:</strong> <?php echo (string)$scope->StartRange; ?></div>
|
||||||
|
<div class="col-md-4"><strong><?php echo $w_end; ?>:</strong> <?php echo (string)$scope->EndRange; ?></div>
|
||||||
|
<div class="col-md-4"><strong><?php echo $w_mask; ?>:</strong> <?php echo (string)$scope->SubnetMask; ?></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h6 class="fw-bold border-bottom"><?php echo $w_scopeOptions; ?></h6>
|
||||||
|
<?php foreach ($scope->OptionValues->OptionValue as $sOpt):
|
||||||
|
$sIdx = (string)$sOpt->OptionId;
|
||||||
|
$sVals = [];
|
||||||
|
foreach ($sOpt->Value as $sv) $sVals[] = (string)$sv;
|
||||||
|
?>
|
||||||
|
<div class="row small row-option">
|
||||||
|
<div class="col-md-3"><strong><?php echo $sIdx; ?></strong> <?php echo $definitions[$sIdx] ?? ''; ?></div>
|
||||||
|
<div class="col-md-6"><?php echo implode(" ; ", $sVals); ?></div>
|
||||||
|
<div class="col-md-3 text-muted"><?php echo (string)$sOpt->VendorClass; ?></div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
|
||||||
|
<h6 class="fw-bold border-bottom mt-3"><?php echo $w_reservations; ?></h6>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-sm table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr class="table-secondary">
|
||||||
|
<th><?php echo $w_name; ?></th><th>IP</th><th>MAC</th><th>Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
$reservations = $scope->Reservations->Reservation ?? null;
|
||||||
|
if ($reservations):
|
||||||
|
foreach ($reservations as $res): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo (string)$res->Name; ?></td>
|
||||||
|
<td><?php echo (string)$res->IPAddress; ?></td>
|
||||||
|
<td><code><?php echo (string)$res->ClientId; ?></code></td>
|
||||||
|
<td class="text-muted"><?php echo (string)$res->Description; ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach;
|
||||||
|
else: ?>
|
||||||
|
<tr><td colspan="4" class="text-center text-muted"><em>Aucune réservation sur ce scope</em></td></tr>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
69
Network/dhcp_servers.php
Normal file
69
Network/dhcp_servers.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
// Include global configurations
|
||||||
|
include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php";
|
||||||
|
|
||||||
|
$ts = date("Y-m-d");
|
||||||
|
$serversData = Invoke_Entry01("SELECT Server,TS FROM dump_dhcp where ts ='$ts' order by server asc");
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-t">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
|
||||||
|
<title>Web Infra Reports IT</title>
|
||||||
|
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
|
||||||
|
|
||||||
|
<script src="/js/jquery-3.6.1.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
||||||
|
<link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css">
|
||||||
|
<link rel="stylesheet" href="/css/preloader.css">
|
||||||
|
<script src="/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="/css/bootstrap-table.min.css">
|
||||||
|
<script src="/js/bootstrap-table.min.js"></script>
|
||||||
|
<script src="/js/bootstrap-table-fr-FR.min.js"></script>
|
||||||
|
<script src="/js/tableExport.min.js"></script>
|
||||||
|
<script src="/js/bootstrap-table-export.min.js"></script>
|
||||||
|
<script src="/js/libs/js-xlsx/xlsx.core.min.js"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="bg-light text-dark">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row flex-nowrap">
|
||||||
|
<div class="col-auto col-md-2 col-xl-2 px-sm-2 px-0 bg-dark vh-100 position-sticky top-0">
|
||||||
|
<?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col py-3">
|
||||||
|
<h1><span class="badge text-bg-secondary w-100"><?php echo count($serversData); ?> DHCP <?php echo $w_server; ?></span></h1>
|
||||||
|
|
||||||
|
<div class="container mt-4">
|
||||||
|
<table class='table table-bordered table-hover table-sm' id='t1' data-height="620" data-toggle="table" data-search="true" data-show-columns="true" data-export-types="['xlsx','csv','json']" data-show-export="true" data-sortable="true">
|
||||||
|
<thead class="table-light">
|
||||||
|
<tr>
|
||||||
|
<th data-field="Server" data-sortable="true"><?php echo $w_server; ?></th>
|
||||||
|
<th data-field="Last" data-sortable="true"><?php echo $w_backuplu; ?></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($serversData as $row): ?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="dhcp_detail.php?s=<?php echo urlencode($row['Server']); ?>" class="fw-bold">
|
||||||
|
<?php echo $row['Server']; ?>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $row['TS']; ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -142,3 +142,10 @@
|
|||||||
$w_nextRollup = "Next Rollup";
|
$w_nextRollup = "Next Rollup";
|
||||||
$w_storageTotalGB = "Storage Total GB";
|
$w_storageTotalGB = "Storage Total GB";
|
||||||
$w_storageUsedGB = "Storage Used GB";
|
$w_storageUsedGB = "Storage Used GB";
|
||||||
|
$w_network = "Network";
|
||||||
|
$w_start = "Start";
|
||||||
|
$w_end = "End";
|
||||||
|
$w_mask = "Mask";
|
||||||
|
$w_scopeOptions = "Scope Options";
|
||||||
|
$w_reservations = "Reservations";
|
||||||
|
$w_globalOptionValues = "Global Options Values";
|
||||||
@@ -141,4 +141,11 @@
|
|||||||
$w_lastUpdate = "Dernière Mise à Jour";
|
$w_lastUpdate = "Dernière Mise à Jour";
|
||||||
$w_nextRollup = "Prochain Cumulatif";
|
$w_nextRollup = "Prochain Cumulatif";
|
||||||
$w_storageTotalGB = "Stockage Total GB";
|
$w_storageTotalGB = "Stockage Total GB";
|
||||||
$w_storageUsedGB = "Stockage Utilisé GB";
|
$w_storageUsedGB = "Stockage Utilisé GB";
|
||||||
|
$w_network = "Réseau";
|
||||||
|
$w_start = "Début";
|
||||||
|
$w_end = "Fin";
|
||||||
|
$w_mask = "Masque";
|
||||||
|
$w_scopeOptions = "Options de portée";
|
||||||
|
$w_reservations = "Réservations";
|
||||||
|
$w_globalOptionValues = "Valeurs des Options Globales";
|
||||||
|
|||||||
13
navbar.html
13
navbar.html
@@ -158,13 +158,22 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#network" data-bs-toggle="collapse" class="nav-link px-0 align-middle">
|
||||||
|
<i class="fs-6 bi bi-diagram-3 text-white"></i> <span class="ms-1 d-none d-sm-inline text-white h7"><small><?php echo $w_network; ?></small></span><i class="bi bi-caret-down"></i> </a>
|
||||||
|
<ul class="collapse nav flex-column ms-1" id="network" data-bs-parent="#menu">
|
||||||
|
<li class="w-100">
|
||||||
|
<a href="/Network/dhcp_servers.php" class="nav-link px-0" > <span class="d-none d-sm-inline text-white h7">- DHCP</span></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#secureboot" data-bs-toggle="collapse" class="nav-link px-0 align-middle">
|
<a href="#secureboot" data-bs-toggle="collapse" class="nav-link px-0 align-middle">
|
||||||
<i class="fs-6 bi bi-pc text-white"></i> <span class="ms-1 d-none d-sm-inline text-white h7"><small><?php echo $nav_10; ?></small></span><i class="bi bi-caret-down"></i> </a>
|
<i class="fs-6 bi bi-pc text-white"></i> <span class="ms-1 d-none d-sm-inline text-white h7"><small><?php echo $nav_10; ?></small></span><i class="bi bi-caret-down"></i> </a>
|
||||||
<ul class="collapse nav flex-column ms-1" id="secureboot" data-bs-parent="#menu">
|
<ul class="collapse nav flex-column ms-1" id="secureboot" data-bs-parent="#menu">
|
||||||
<li class="w-100">
|
<li class="w-100">
|
||||||
<a href="/secureboot/secureboot-SRV.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- <?php echo $nav_10_1; ?></span></a>
|
<a href="/SecureBoot/SecureBoot-SRV.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- <?php echo $nav_10_1; ?></span></a>
|
||||||
<a href="/secureboot/secureboot-WS.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- <?php echo $nav_10_2; ?></span></a>
|
<a href="/SecureBoot/SecureBoot-WS.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- <?php echo $nav_10_2; ?></span></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user