<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Conn.asp"-->
<!--#include file="Ex_Cls/Ex_CommonCls.asp"-->
<!--#include file="Ex_Cls/Ex_FsoCls.asp"-->
<!--#include file="Ex_Cls/Ex_XmlCls.asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>易心博客安装向导</title>
<script language="javascript" runat="server" type="text/javascript">	
  function dopost(str)
  {
	str=escape(str);
	return str;
  }
  </script>
<style type="text/css">
<!--
body {
	font-size:12px;
	text-align:center;
}
#head {
	width:100%;
	height:40px;
	background:#8CAADE;
	font-weight:bold;
	color:#FFFFFF;
	line-height:40px;
	text-align:center;
}
#body {
	margin:5px auto 5px auto;
	width:800px;
	border:solid 1px #8CAADE;
}
#left {
	float:left;
	width:50%;
	border:0px;
	line-height:23px;
}
#right {
	float:right;
	width:50%;
	border:0px;
	line-height:23px;
}
#result {
	width:800px;
	height:30px;
	text-align:center;
}
#bottom {
	margin-top:5px;
	width:800px;
	height:30px;
	text-align:center;
}
#bottom a {
	color:red;
	text-decoration:none;
}
-->
</style>
</head>
<body>
<%
Dim Install
Set Install=new InstallCls
Install.execute
Class InstallCls
Private Exblog,FsoCls,XmlCls,flag,domain
Private Sub class_initialize
	Set Exblog=new Ex_CommonCls
	Set FsoCls=new Ex_FsoCls
	Set XmlCls=new Ex_XmlCls
	flag=0
	domain=Replace(LCase(Exblog.GetDomain()&request.servervariables("script_name")),"install.asp","")
End Sub
Private Sub class_terminate
	Set Exblog=Nothing
	Set FsoCls=Nothing
	Set XmlCls=Nothing
End Sub
Private Function  ReplaceSn(ByVal str,ByVal sn)
	Dim temp
	str=Replace(str,"%","@")
	temp=Replace(str,str,"<@Const Sn="""&sn&"""@>")
	ReplaceSn=Replace(Temp,"@","%")
End Function 
public Sub execute
dim action
action=request("step")
Exblog.ClearCaches(sn)
Exblog.GetConfigCache("*")
If FsoCls.CheckExist("lock.txt","file") And lcase(action)<>"y" And LCase(action)<>"n" Then 
	Response.Write("请删除博客根目录中的lock.txt再安装。")
	Response.End 
End If 
Select Case action
	Case "2"
	setf
	Case "3"
	seting
	Case "Y"
	FsoCls.delFile("install.asp")
	response.redirect("admin_login.asp")
	Case "N"
	response.redirect("admin_login.asp")
	Case Else
	check
End Select
End sub
Function CheckObjInstalled(strClassString,flag)
	On Error Resume Next
	Dim Temp
	Err = 0
	Dim TmpObj
	Set TmpObj = Server.CreateObject(strClassString)
	Temp = Err
	IF Temp = 0 OR Temp = -2147221477 Then
		response.write "<font color=""#00FF00""><b>√</b></font>"
	ElseIF Temp = 1 OR Temp = -2147221005 Then
		response.write "<font color=""#FF0000""><b>×</b></font>"
		If strClassString="Scripting.FileSystemObject" Or strClassString="adodb.connection" Then
			Flag=2
		ElseIf flag<1 then
			Flag=1
		End if
	End IF
	Err.Clear
	Set TmpObj = Nothing
	Err = 0
End Function
Sub Check
%>
<div id="head">易心博客安装向导（服务器组件检测完成）</div>
<div id="body">
	<div id="left">
	服务器环境<br>
	服务器IIS版本：
	<%
	Response.Write Request.ServerVariables("SERVER_SOFTWARE")
	If Replace(Request.ServerVariables("SERVER_SOFTWARE"),"Microsoft-IIS/","")>"5" Then
		Response.Write "<font color=""#00FF00""><b>√</b></font>"
	Else
		Response.Write "<font color=""#FF0000""><b>×</b></font>"
		flag=2
	End if
	%><br>
	脚本解释引擎：<%
	Dim Version
	Version=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion
	If Replace(Version,"VBScript/","")>"5.6" Then
		Response.Write "<font color=""#00FF00""><b>√</b></font>"
	Else
		Response.Write "<font color=""#FF0000""><b>×</b></font>"
		flag=2
	End if
	%><br>
	FSO组件：<%CheckObjInstalled "Scripting.FileSystemObject",flag%><br>
	ADODB组件：<%CheckObjInstalled "adodb.connection",flag%><br>
	Jmail组件支持：<%CheckObjInstalled "JMail.SMTPMail",flag %><BR>
	无组件上传－ADODB.Stream：<%CheckObjInstalled "Scripting.Dictionary",flag %><BR>
	无组件上传－Scripting.Dictionary ：<%CheckObjInstalled "Scripting.Dictionary",flag %><BR>
	Persits.Jpeg组件：<%CheckObjInstalled "Persits.Jpeg",flag %><BR>
	microsoft.xmldom组件：<%CheckObjInstalled "microsoft.xmldom",flag %><BR>
	MSXML2.ServerXMLHTTP组件：<%CheckObjInstalled "MSXML2.ServerXMLHTTP",flag %><BR>
	</div>
	<div id="right">
	易心博客所需环境<br>
	服务器IIS版本：Microsoft-IIS/5.0及更高版本<br>
	VBScript/5.6及更高版本<br>
	用于生成静态文件<BR>
	需要access数据库支持<BR>
	用于把写的日志作为邮件发送到邮箱<BR><BR>
	用于上传图片 等文件<BR>
	用于图片缩放<BR>
	用于操作xml文档<BR>
	用于保存远程文件<BR>
	</div>
</div>
<div id="result">
<%
	If flag=0 Then
		response.write "<font color=blue>恭喜恭喜，服务器具备博客所需的所有组件要求。您可以进入下一步的安装检测。^^&nbsp;&nbsp;&nbsp;&nbsp;<a href=""?step=2"">下一步</a></font>"
	ElseIf flag=2 then
		response.write "<font color=red>不幸啊，你的服务器不支持一些关键组件。建议使用易心空间使用全部功能。</font>"
	Else
		response.write "<font color=red>没关系的，你仍然可以进行下一步安装检测。</font>&nbsp;&nbsp;&nbsp;&nbsp;<a href=""?step=2"">下一步</a>"
	End If
%>
</div>
<%
End Sub
Sub SetF
Dim t
t=timer
%>
<script>
function Check()
{
	if (document.getElementById("adName").value=="" || document.getElementById("adPwd").value=="")
	{
		alert("管理员名和管理员密码必须填写");
		document.getElementById("adName").focus();
		return false;
	}
	if (document.getElementById("adPwd").value!=document.getElementById("adPwd1").value)
	{
		alert("两次输入的密码不一致");
		document.getElementById("adPwd").focus();
		return false;
	}
}
</script>
<div id="head">易心博客安装向导（系统设置）</div>
<div id="body">
	<FORM METHOD=POST ACTION="?step=3" onsubmit="return Check()">
		管理员名：<INPUT TYPE="text" NAME="adName"><br>
		管理密码：<INPUT TYPE="password" NAME="adPwd"><br>
		密码确认：<INPUT TYPE="password" NAME="adPwd1"><br>
		博客网址：<INPUT TYPE="text" NAME="blogurl" readonly value="<%=domain%>"><br>
		系统&nbsp;&nbsp;SN：<INPUT TYPE="text" NAME="sysSn" readonly value="<%=md5(t)%>"><br><BR>
		说明:博客网址和系统SN由程序自动填写，不必修改。<BR><BR>
		<INPUT TYPE="submit" value="确定">
	</FORM>
</div>
<%
End Sub
Sub  PostHttpPage(RefererUrl,PostUrl,PostData) 
	On Error Resume Next 
    Dim xmlHttp 
    Dim RetStr      
    Set xmlHttp = CreateObject("Msx" & "ml2.XM" & "LHT" & "TP")  
    xmlHttp.Open "POST", PostUrl, False
    XmlHTTP.setRequestHeader "Content-Length",Len(PostData) 
    xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    xmlHttp.setRequestHeader "Referer", RefererUrl
    xmlHttp.Send PostData
    Set xmlHttp = nothing
End Sub 
Sub seting
	On Error Resume next
	Dim adname,blogname,adpwd,blogurl,sn,C
	adname=Exblog.G(request("adname"))
	adpwd=md5(request("adpwd"))
	blogurl=Exblog.G(request("blogurl"))
	sn=Exblog.G(request("sysSn"))
	Conn.execute "update Ex_Config set adname='"&adname&"',adpwd='"&adpwd&"',blogurl='"&blogurl&"',domain='是',ischeckcode='否'"
	If Err.number<>0 Then 
		Response.Write "<div id=""head"">易心博客安装向导（安装文件处理）</div>"&vbcrlf
		Response.Write "<div id=""body"">"&vbcrlf
		Response.Write "安装出错,错误描述:"&Err.description
		If InStr(Err.description,"可更新")<>0 Or InStr(Err.description,"updateable")<>0 Then 
			Response.Write "<br>可能是您对文件夹权限设置不当导致。确认程序对数据库有读写权限。<a href=""http://www.ex123.net/help/html/blogview-75-3401_1.html"" target=""_blank"">点此查看解决方法。</a>"
		End If 
		Response.Write "</div>"
		Exit Sub 
	End If 
	C=FsoCls.ReadFile("inc/Sn.asp")
	FsoCls.CreateFile "inc/Sn.asp",ReplaceSn(C,sn)
	If Err.number<>0 Then 
		Response.Write "<div id=""head"">易心博客安装向导（安装文件处理）</div>"&vbcrlf
		Response.Write "<div id=""body"">"&vbcrlf
		Response.Write "安装出错,错误描述:"&Err.description
		If InStr(Err.description,"没有权限")<>0 Then 
			Response.Write "<br>可能是您对文件夹权限设置不当导致。确认程序对sn.asp文件有读写权限。<a href=""http://www.ex123.net/help/html/blogview-75-3401_1.html"" target=""_blank"">点此查看解决方法。</a>&nbsp;&nbsp;<A HREF=""http://www.ex123.net/host.html"">建议使用易心博客专用空间</A>"
		End If 
		Response.Write "</div>"
		Exit Sub 
	End If 
	'XmlCls.letFilePath="Version.xml"
	'XmlCls.createXml()
	'XmlCls.addNode "","Version","3.0"
	'XmlCls.addNode "","CreateTime",""&Date()&""
	If Err.number<>0 Then 
		Response.Write "<div id=""head"">易心博客安装向导（安装文件处理）</div>"&vbcrlf
		Response.Write "<div id=""body"">"&vbcrlf
		Response.Write "安装出错,错误描述:"&Err.description
		If InStr(Err.description,"缺少对象")<>0 Then 
			Response.Write "<br><a href=""http://www.ex123.net/help/html/blogview-75-3402_1.html"" target=""_blank"">点此查看解决方法。</a>&nbsp;&nbsp;<A HREF=""http://www.ex123.net/host.html"">建议使用易心博客专用空间</A>"
		Else 
			Response.Write "<br><a href=""http://www.ex123.net/help"" target=""_blank"">点此查看解决方法。</a>&nbsp;&nbsp;<A HREF=""http://www.ex123.net/host.html"">建议使用易心博客专用空间</A>"
		End If 
		Response.Write "</div>"
		Exit Sub 
	End If 
	'PostHttpPage "http://www.ex123.net/server/","http://www.ex123.net/server/collect.asp?","blogname="&dopost("易心博客Vip")&"&blogurl="&blogurl&""
%>
<div id="head">易心博客安装向导（安装文件处理）</div>
<%
	response.write "<div id=""body""><BR><BR>易心博客是以<a href=""http://host.ex123.net"">易心空间</a>为基础而开发，建议在易心空间上使用以获得更好的运行效果。<br>您的序列号文件Sn.asp在本次安装中已经使用，再次安装请重新到<a href=""http://www.ex123.net"">易心博客论坛</a>下载,否则再次安装将不能成功。<br>为了安全建议删除安装向导文件,需要时再到易心博客站下载.是否删除?&nbsp;&nbsp;<a href=?step=Y>删除</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=?step=N>保留</a><BR><BR><BR></div>"
	FsoCls.CreateFile "lock.txt","易心博客"
End Sub
End Class
%>
<div id="bottom">Power By <a href="http://www.ex123.net">易心博客</a></div>
</body>
</html>
