我编写了一个PHP代码来解码证书并列出其内容。我无法理解以下代码的问题。该代码适用于Chrome和IE,但不适用于Firefox。我已经清除了浏览器缓存并且仍然无法在所有计算机上获得预期的输出。请帮帮我。
注意:我确实理解这纯粹是服务器端活动,但仍然没有客户端为Firefox浏览器提供预期的解码输出
cert.php
<form method="post" action="">
<textarea id="cert_input" name="cert_input" rows="10" wrap="hard"
value="<?= isset($_POST['cert_input']) ?>" /></textarea>
<input type="submit" name="submit_button" value="Decode" id="submit_button" />
</form>
<?php
if (isset($_POST['submit_button'])) {
echo '<font face="Tahoma" size="2" ></br></br>';
echo '<font color="#747474">Certificate Details:</br></font>';
$str = $_POST['cert_input'];
$cert = openssl_x509_parse($str);
$validFrom = date('r', $cert['validFrom_time_t']);
$validTo = date('r', $cert['validTo_time_t']);
function days_Apart($start, $end) {
$start_ts = strtotime($start);
$end_ts = strtotime($end);
$diff = $end_ts - $start_ts;
return round($diff / 86400);
}
$remaining_days = days_Apart($validFrom, $validTo);
if ($remaining_days > 0) {
$status = 'Active';
echo "<table id='minimal' style='border:1px solid #4dff4d;background-color:#f5fff5;'>";
}
else {
$status = 'Expired';
echo "<table id='minimal' style='border:1px solid #ff3300;background-color:#ffefef;'>";
}
echo "
<tr>
<td>COMMON NAME [CN]</td>
<td>" . $cert['subject']['CN'] . "</td>
</tr>
<tr>
<td>ORGANISATION [O]</td>
<td>" . $cert['subject']['O'] . "</td>
</tr>
<tr>
<td>ORGANISATION UNIT [OU]</td>
<td>" . $cert['subject']['OU'] . "</td>
</tr>
<tr>
<td>LOCALITY [L]</td>
<td>" . $cert['subject']['L'] . "</td>
</tr>
</table>";
echo '</font>';
}
?>