Example #1
0
<?php

include "_config.php";
$error = '';
// create new
if (!empty($_POST)) {
    try {
        $domain = $_POST['domain'];
        $sans = explode("\n", $_POST['san']);
        $ce = new \App\CertificateHandler();
        $ce->issueNewCertificate($domain, $sans);
        redirect("detail?domain={$domain}");
    } catch (\Exception $e) {
        $error = $e->getMessage();
    }
}
$title = "Issue new certificate";
include "_header.php";
?>

<div class="head">
    <h1>Issue new certificate</h1>
    <p><a href="index">&larr; Back to the certificates list</a></p>
</div>

<div class="card">
    <form method="post" action="">

        <?php 
if (!empty($error)) {
    ?>
Example #2
0
<?php

include "_config.php";
$ce = new \App\CertificateHandler();
$domain = $ce->findByDomain($_GET['domain']);
if (!$domain) {
    e404();
}
try {
    $ce = new \App\CertificateHandler();
    $ce->issueNewCertificate($domain->getName(), $domain->getSAN());
    redirect("detail?domain=" . $domain->getName());
} catch (\Exception $e) {
    $error = $e->getMessage();
    include "detail.php";
}