58 lines
1.8 KiB
HTML
58 lines
1.8 KiB
HTML
<?php
|
|
|
|
$leases = [];
|
|
$filename = "dhcpleases.txt";
|
|
$file_handle = fopen($filename, "rb");
|
|
while(!feof($file_handle))
|
|
{
|
|
$leases[] = fgetcsv($file_handle, 0, ';');
|
|
}
|
|
|
|
?>
|
|
|
|
<html>
|
|
<head>
|
|
<title>DHCP leases</title>
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
|
|
<style>
|
|
.content
|
|
{
|
|
padding: 40px 80px 0;
|
|
}
|
|
.monospace
|
|
{
|
|
font-family: monospace;
|
|
font-size: 15px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="content">
|
|
<h1>DHCP leases</h1>
|
|
<table class="table table-striped table-hover table-bordered">
|
|
<caption>
|
|
<?=$filename?> was last modified: <strong style="font-weight: 500"><?=date("F d Y H:i:s.", filemtime($filename))?></strong>
|
|
</caption>
|
|
<thead>
|
|
<tr>
|
|
<th>Expire time</th>
|
|
<th>MAC address</th>
|
|
<th>IP address</th>
|
|
<th>Hostname</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach($leases as $lease): ?>
|
|
<tr>
|
|
<td><?=$lease[0]?></td>
|
|
<td class="monospace"><?=$lease[1]?></td>
|
|
<td class="monospace"><?=$lease[2]?></td>
|
|
<td><a href="<?=strpos($lease[3], 'http') !== 0 ? "http://{$lease[3]}" : $lease[3]?>"><?=$lease[3]?></a></td>
|
|
</tr>
|
|
<?php endforeach ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</body>
|
|
</html>
|