Portal - allow clients to see certs/domains

This commit is contained in:
wrongecho 2024-09-05 17:56:42 +01:00
parent 91fb4b663a
commit f2c15b4650
3 changed files with 122 additions and 0 deletions

61
portal/certificates.php Normal file
View File

@ -0,0 +1,61 @@
<?php
/*
* Client Portal
* Certificate listing for PTC / technical contacts
*/
header("Content-Security-Policy: default-src 'self' fonts.googleapis.com fonts.gstatic.com");
require_once "inc_portal.php";
if ($session_contact_primary == 0 && !$session_contact_is_technical_contact) {
header("Location: portal_post.php?logout");
exit();
}
$certificates_sql = mysqli_query($mysqli, "SELECT certificate_id, certificate_name, certificate_domain, certificate_issued_by, certificate_expire FROM certificates WHERE certificate_client_id = $session_client_id AND certificate_archived_at IS NULL ORDER BY certificate_expire ASC");
?>
<h3>Web Certificates</h3>
<div class="row">
<div class="col-md-10">
<table class="table tabled-bordered border border-dark">
<thead class="thead-dark">
<tr>
<th>Certificate Name</th>
<th>FQDN</th>
<th>Issuer</th>
<th>Expiry</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_array($certificates_sql)) {
$certificate_name = nullable_htmlentities($row['certificate_name']);
$certificate_domain = nullable_htmlentities($row['certificate_domain']);
$certificate_issued_by = nullable_htmlentities($row['certificate_issued_by']);
$certificate_expire = nullable_htmlentities($row['certificate_expire']);
?>
<tr>
<td><?php echo $certificate_name; ?></td>
<td><?php echo $certificate_domain; ?></td>
<td><?php echo $certificate_issued_by; ?></td>
<td><?php echo $certificate_expire; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<?php
require_once "portal_footer.php";

55
portal/domains.php Normal file
View File

@ -0,0 +1,55 @@
<?php
/*
* Client Portal
* Domain listing for PTC / technical contacts
*/
header("Content-Security-Policy: default-src 'self' fonts.googleapis.com fonts.gstatic.com");
require_once "inc_portal.php";
if ($session_contact_primary == 0 && !$session_contact_is_technical_contact) {
header("Location: portal_post.php?logout");
exit();
}
$domains_sql = mysqli_query($mysqli, "SELECT domain_id, domain_name, domain_expire FROM domains WHERE domain_client_id = $session_client_id AND domain_archived_at IS NULL ORDER BY domain_expire ASC");
?>
<h3>Domains</h3>
<div class="row">
<div class="col-md-10">
<table class="table tabled-bordered border border-dark">
<thead class="thead-dark">
<tr>
<th>Domain Name</th>
<th>Expiry</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_array($domains_sql)) {
$domain_name = nullable_htmlentities($row['domain_name']);
$domain_expire = nullable_htmlentities($row['domain_expire']);
?>
<tr>
<td><?php echo $domain_name; ?></td>
<td><?php echo $domain_expire; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<?php
require_once "portal_footer.php";

View File

@ -69,6 +69,12 @@ header("X-Frame-Options: DENY"); // Legacy
<li class="nav-item">
<a class="nav-link <?php if (basename($_SERVER['PHP_SELF']) == "contacts.php") {echo "active";} ?>" href="contacts.php">Contacts</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if (basename($_SERVER['PHP_SELF']) == "domains.php") {echo "active";} ?>" href="domains.php">Domains</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if (basename($_SERVER['PHP_SELF']) == "certificates.php") {echo "active";} ?>" href="certificates.php">Certificates</a>
</li>
<?php } ?>
</ul>