/*
Copyright (C) 2004 by Duane Groth
This file is part of CAcert.
CAcert has been released under the CAcert Source License
which can be found included with these source files or can
be downloaded from the internet from the following address:
http://www.cacert.org/src-lic.php
CAcert is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the License for more details.
*/ ?>
$certid = intval($cert);
$query = "select * from `orgemailcerts`,`org` where `orgemailcerts`.`id`='$certid' and
`org`.`memid`='".$_SESSION[profile][id]."' and
`org`.`orgid`=`orgemailcerts`.`orgid`";
$res = mysql_query($query);
if(mysql_num_rows($res) <= 0)
{
showheader(_("My CAcert.org Account!"));
echo _("No such certificate attached to your account.");
showfooter();
exit;
}
$row = mysql_fetch_assoc($res);
$cert = `/usr/bin/openssl x509 -in $row[crt_name]`;
if($row[keytype] == "NS")
{
if($install == 1)
{
header("Content-Type: application/x-x509-user-cert");
header("Content-Length: ".strlen($cert));
header('Content-Disposition: inline; filename="'.$row[CN].'.crt"');
echo $cert;
exit;
} else {
showheader(_("My CAcert.org Account!"));
echo "
"._("Installing your certificate")."
\n";
echo "
"._("You are about to install a certificate, if you are using mozilla/netscape based browsers you will not be informed that the certificate was installed successfully, you can go into the options dialog box, security and manage certificates to view if it was installed correctly however.")."