hanno
zertifikate und keys exportieren um datenmüll zu vermeiden
hanno commited 0ba4f0f at 2009-09-04 19:02:40
<?php
require_once('inc/base.php');
require_once('inc/security.php');
define("CERT_OK", 0);
define("CERT_INVALID", 1);
define("CERT_NOCHAIN", 2);
function user_certs()
{
$uid = (int) $_SESSION['userinfo']['uid'];
$result = db_query("SELECT id, valid_from, valid_until, subject, cn FROM vhosts.certs WHERE uid=${uid}");
$ret = array();
while ($i = mysql_fetch_assoc($result))
$ret[] = $i;
DEBUG($ret);
return $ret;
}
function user_csr()
{
$uid = (int) $_SESSION['userinfo']['uid'];
$result = db_query("SELECT id, created, hostname, bits FROM vhosts.csr WHERE uid=${uid}");
$ret = array();
while ($i = mysql_fetch_assoc($result))
$ret[] = $i;
DEBUG($ret);
return $ret;
}
function cert_details($id)
{
$id = (int) $id;
$uid = (int) $_SESSION['userinfo']['uid'];
$result = db_query("SELECT id, lastchange, valid_from, valid_until, subject, cn, cert, `key` FROM vhosts.certs WHERE uid={$uid} AND id={$id}");
if (mysql_num_rows($result) != 1)
system_failure("Ungültiges Zertifikat #{$id}");
return mysql_fetch_assoc($result);
}
function csr_details($id)
{
$id = (int) $id;
$uid = (int) $_SESSION['userinfo']['uid'];
$result = db_query("SELECT id, created, hostname, bits, csr, `key` FROM vhosts.csr WHERE uid={$uid} AND id={$id}");
if (mysql_num_rows($result) != 1)
system_failure("Ungültiger CSR");
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX