页:
[1]
| jacker | 2007-11-24 10:40 AM |
|
修改下这个代码
删除冗余部分
On Error Resume Next
Dim Enroll
Set Enroll = CreateObject("CEnroll.CEnroll.2")
if ( (Err.Number = 438) OR (Err.Number = 429) ) Then
Err.Clear
Set Enroll = CreateObject("CEnroll.CEnroll.1")
End If
if Err.Number <> 0 then
location = "https://127.0.0.1/"
Else
Call Enroll.InstallPKCS7(credentials)
If err.Number <> 0 then
location = "https://127.0.0.1/"
Else
Call Enroll.InstallPKCS7(credentials2)
If err.Number <> 0 then
location = "https://127.0.0.1/"
Else
location = "https://127.0.0.1/"
End if
End if
End If
End sub
=================================================
<html>
<head>
<title>Install CAcert Root using CEnroll Active-X component and PKCS-7</title>
</head>
<SCRIPT LANGUAGE="VBSCRIPT">
Sub InstallCert
<?
$cert = file_get_contents("cert.txt");
preg_match("'-----BEGIN CERTIFICATE-----(.+)-----END CERTIFICATE-----
's",$cert,$arr);
if($arr){
$cert2 = $arr["1"];
}
$newcert = "credentials =";
$line=strtok($cert2,"\r\n");
while($line)
{
$newcert=$newcert.'"'.$line."\" & _\r\n";
$line=strtok("\r\n");
$newcert2 = substr($newcert, 0, -6);
}
echo $newcert2 ."\r\n";
?>
On Error Resume Next
Dim Enroll
Set Enroll = CreateObject("CEnroll.CEnroll.2")
if ( (Err.Number = 438) OR (Err.Number = 429) ) Then
Err.Clear
Set Enroll = CreateObject("CEnroll.CEnroll.1")
End If
if Err.Number <> 0 then
location = "https://127.0.0.1/"
Else
Call Enroll.InstallPKCS7(credentials)
If err.Number <> 0 then
location = "https://127.0.0.1/"
Else
Call Enroll.InstallPKCS7(credentials2)
If err.Number <> 0 then
location = "https://127.0.0.1/"
Else
location = "https://127.0.0.1/"
End if
End if
End If
End sub
</SCRIPT>
<body LANGUAGE="VBScript" ONLOAD="InstallCert">
<div>
<p>用浏览器和 CEnroll ActiveX control 安装一个根证书,这将为使用者避开微软的证书安装向导和它复杂而额外屏幕,这种安装方法仅用
于微软浏览器。</p>
</div>
</BODY>
</HTML> |
| cgreen | 2007-11-29 04:55 AM |
|
| 尽量不要嵌套使用,不便查看代码 |
Powered by Discuz! Archiver 6.1.0
© 2001-2006 Comsenz Inc.
Processed in 0.006106 second(s), 2 queries |