⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 createvhost.asp

📁 蓝芒3.0A最新所有功能完整破解版
💻 ASP
📖 第 1 页 / 共 2 页
字号:
	Rs.Close
	
	strSQL="Select * from T_DNS_AllVH where VHName='" & FtpAccount & "' or VHName='" & HostName & "'"
	Rs.open strSQL,Cn
	if not Rs.eof then
		Rs.Close
		Response.Write "此虚拟主机名重复了,请重新输入虚拟主机名!"
		Call PrintPageBottom
		Response.End
	end if
	Rs.Close
	
	if Trim(Domain)<>"" then
		if IsNULL(DomainHead) or Trim(DomainHead)="" then
			strSQL="Select * from T_DNS_AllBDN Where BDN='" & Domain & "'"
		else
			strSQL="Select * from T_DNS_AllBDN Where BDN='" & DomainHead & "." & Domain & "'"
		end if
		Rs.open strSQL,Cn
		if not Rs.eof then
			Rs.Close
			Response.Write "此虚拟主机名绑定的域名重复了,请重新输入绑定域名!"
			Call PrintPageBottom
			Response.End
		end if
		Rs.Close
		
		if Request.Form("HaveMail")="YES" then
			strSQL="Select * from T_DNS_AllPost where BPostDN='" & MailDomain & "'"
			Rs.open strSQL,Cn
			if not Rs.eof then
				Rs.Close
				Response.Write "此邮局域名重复了,虚拟主机已开通成功!"
				Call PrintPageBottom
				Response.End
			end if
			Rs.Close
		end if
	end if
	
	if IsFtpUserExist(ServerIP,FtpAccount)=0 then
		Response.Write "该FTP用户已经存在, 请重新输入用户名称!"
		Call PrintPageBottom
		Response.End
	end if
	
	if CreateWebDirectory(ServerIP,FtpAccount)<>0 then
		Response.Write "建立虚拟主机失败, 请重新尝试! 错误码: 1"
		Call PrintPageBottom
		Response.End
	end if
	
	if Trim(Domain)="" then
		ReDim Bindings(0)
		Bindings(0)=":80:" & FtpAccount & ServerDomain
	else
		ReDim Bindings(1)
		Bindings(0)=":80:" & FtpAccount & ServerDomain
		if IsNULL(DomainHead) or Trim(DomainHead)="" then
			Bindings(1)=":80:" & Domain
		else
			Bindings(1)=":80:" & DomainHead & "." & Domain
		end if
	end if
	
	if CreateIISServer(ServerIP,FtpAccount,FtpAccount & "\" & Opt_System_UserWebRoot,Bindings,ServerType,SiteNum)<>0 then
		Response.Write "建立虚拟主机失败, 请重新尝试! 错误码: 2"
		Call PrintPageBottom
		Response.End
	end if
	
	if CreateFtpUser(ServerIP,FtpAccount,FtpPassword,FtpAccount,CStr(Cint(SiteSize)*1000*1024),strEndDate)<>0 then
		Response.Write "建立虚拟主机失败, 请重新尝试! 错误码: 3"
		Call PrintPageBottom
		Response.End
	end if
	
	if SetLogFileDirectory(ServerIP,SiteNum,GetUserHomeDir(ServerIP,FtpAccount) & Opt_System_UserLogRoot)<>0 then
		Response.Write "建立虚拟主机失败, 请重新尝试! 错误码: 4"
		Call PrintPageBottom
		Response.End
	end if
	
	if CreateDBVisualPath(ServerIP, SiteNum, FtpAccount & "\" & Opt_System_DBRoot,"DataBase")<>0 then
		Response.Write "建立虚拟主机失败, 请重新尝试! 错误码: 5"
		Call PrintPageBottom
		Response.End
	end if

	if SetMaxConnections(ServerIP, SiteNum, MaxIIS)<>0 then
		Response.Write "建立虚拟主机失败, 请重新尝试! 错误码: 6"
		Call PrintPageBottom
		Response.End
	end if
	
	strSQL="exec SP_BuyVHost " & +_
		"'" & Session("UserID") & "'," & +_
		"'" & ProdCode & "'," & +_
		"'" & HostName & "'," & +_
		"" & ProdYear & "," & +_
		"" & BuyYear & "," & +_
		"'" & IP & "'"
	
	Set sRs= Cn.Execute(strSQL)
	if sRs("result")<>"1" then
		Response.Write sRs("msg")
		Call PrintPageBottom
		Response.End
	else
		UOID=sRs("msg")
	end if
	sRs.Close
	Set sRs=Nothing
	
	Set RsNo= Cn.Execute("SP_PublicNObyRs 'P1120'")
	VHID=RsNo("Result")
	RsNo.Close
	Set RsNo=Nothing
	
	if ServerType="HTML" then
		DefaultPage="default.html, default.htm, index.html, index.htm"
	elseif ServerType="ASP" then
		DefaultPage="default.asp, index.asp, default.html, default.htm, index.html, index.htm"
	else
		DefaultPage="default.asp, index.asp, default.html, default.htm, index.html, index.htm"
	end if
	
	if Trim(Domain)<>"" then
		if IsNULL(DomainHead) or Trim(DomainHead)="" then
		else
			Domain = DomainHead & "." & Domain
		end if
	end if
	
	strSQL="insert into T_DNS_AllVH (VHID,UOID,BPCode,STime,UYear,ETime,UserName,PSW,ServerCode,VHDir,VHName,MaxSecDN,MaxSize,ThiDN,BindDomain,DNSeq,DefHomePage,IfWebLogin,FeeStat,WebStat,FTPStat,VHStat,UserID,Stat,MaxIIS,MaxCPU,MaxBandWidth) values('" & +_
	VHID & "','" & UOID & "','" & BPCode & "',getdate()," & HowLong & ",'" & strEndDate & "','" & FtpAccount & "','" & +_
	FtpPassword & "','" & ServerCode & "','" & FtpAccount & "','" & HostName & "'," & MaxSecDN & "," & SiteSize & +_
	",'" & FtpAccount & ServerDomain & "','" & Domain & "'," & SiteNum & ",'" & DefaultPage & "','N','1','1','1','2'," & UserID & ",'1'," & MaxIIS & "," & MaxCPU & "," & MaxBandWidth & ")"
	Cn.Execute(StrSQL)
	
	if Trim(Domain)<>"" then
		Set RsNo= Cn.Execute("SP_PublicNObyRs 'P1080'")
		BDNID=RsNo("Result")
		RsNo.Close
		strSQL="Insert into T_DNS_AllBDN (BDNID,VHID,BDN,APDNTime) values('" & +_
			BDNID & "','" & VHID & "','" & Domain & "',getdate())"
		Cn.Execute(StrSQL)
	end if
	
	strSQL="Update T_DNS_ServerInfo Set RealSize=RealSize+" & SiteSize & ",RealUser=RealUser+1 Where ServerCode='" & ServerCode & "'"
	Cn.Execute(StrSQL)
	
	
	Subject="开通虚拟主机成功! --" & Opt_System_CompanyName
	MailFile = "../../../Include/MailTemplate/open.txt"
	Send_Email Email,Subject,MailFile,"$注册人$",UserName,"$主机名$",HostName,"$绑定域名$",Domain,"$系统绑定三级域名$",FtpAccount & ServerDomain,"$密码$",FtpPassword,"$年限$",CStr(HowLong),"$开通日期$",strBeginDate,"$到期日期$",strEndDate,"$产品名$",ProdName,"$用户名$",FtpAccount,"$服务器IP$",ServerPubIP,"$默认文档$",DefaultPage
	
	strIfHaveMail="0"
	'==========================如果有赠送邮局=======================================
	if Request.Form("HaveMail")="YES" and Trim(MailDomain)<>"" then
		strIfHaveMail="1"
		strSQL="exec SP_CreateMail " & +_
			"'" & Session("UserID") & "'," & +_
			"'" & "查询" & "'," & +_
			"'" & Request.ServerVariables("REMOTE_ADDR") & "'," & +_
			"'" & ProdCode & "'"
		
		Set Rs= Cn.Execute(strSQL)
        	
		if Rs("result")<>"0" then
			Response.Write Rs("msg")
			Rs.Close
			Call PrintPageBottom
			Response.End
		end if
		ServerCode=Rs("ServerCode")
		ServerIP=Rs("ServerIP")
		MailSize=Rs("MailSize")
		MailUser=Rs("MailUser")
		MailSiteNum=Rs("SiteNum")
		BPCode=Rs("BPCode")
		ProdName=Rs("ProdName")
		ServerPubIP=Rs("ServerPubIP")
		Rs.Close
		
		strSQL="Select * from T_DNS_AllPost where BPostDN='" & MailDomain & "'"
		Rs.open strSQL,Cn
		if not Rs.eof then
			Rs.Close
			Response.Write "此邮局域名重复了,虚拟主机已开通成功!"
			Call PrintPageBottom
			Response.End
		end if
		Rs.Close
		
		if CreateMailDomain(ServerIP,MailDomain)<>0 then
			Response.Write "建立邮局失败, 请重新尝试! 错误码: 1"
			Call PrintPageBottom
			Response.End
		end if
		
		if CreateMailUser(ServerIP,MailDomain,Opt_System_MailManager,MailPassword,"0")<>0 then
			Response.Write "建立邮局失败, 请重新尝试! 错误码: 2"
			Call PrintPageBottom
			Response.End
		end if
		
		if ChangeMailDomainProp(ServerIP,MailDomain,Opt_System_MailManager & "@" & MailDomain, MailUser, CStr(Cint(MailSize)*1000))<>0 then
			Response.Write "建立邮局失败, 请重新尝试! 错误码: 3"
			Call PrintPageBottom
			Response.End
		end if
		
		if AddIISSiteBindings(ServerIP,MailSiteNum,":80:mail." & MailDomain) then
			Response.Write "建立邮局失败, 请重新尝试! 错误码: 4"
			Call PrintPageBottom
			Response.End
		end if
		
		Set RsNo= Cn.Execute("SP_PublicNObyRs 'P1140'")
		PostID=RsNo("Result")
		RsNo.Close
		Set RsNo=Nothing
		
		strSQL="Insert into T_DNS_AllPost (PostID,UOID,BPCode,STime,UYear,ETime,UserName,PSW,ServerCode,BPostDN,MaxSize,MaxUser,FeeStat,PostStat,UserID,Stat,IfSubmit) values('" & +_
		PostID & "','" & UOID & "','" & BPCode & "',getdate()," & HowLong & ",'" & strEndDate & "','" & Opt_System_MailManager & +_
		"','" & MailPassword & "','" & ServerCode & "','" & MailDomain & "'," & MailSize & "," & MailUser & ",'1','1','" & UserID & "','2','0')"
		Cn.Execute(StrSQL)
		
		strSQL="Update T_DNS_ServerInfo Set RealSize=RealSize+" & MailSize & ",RealUser=RealUser+" & MailUser & " Where ServerCode='" & ServerCode & "'"
		Cn.Execute(StrSQL)
		
		Subject="开通邮局(赠送)成功! --" & Opt_System_CompanyName
		MailFile = "../../../Include/MailTemplate/openmail.txt"
		Send_Email Email,Subject,MailFile,"$产品名$(赠送邮局)",ProdName,"$服务器IP$",ServerPubIP,"$绑定域名$",MailDomain,"$年限$",CStr(HowLong),"$密码$",MailPassword,"$用户名$",Opt_System_MailManager & "@" & MailDomain,"$开通日期$",strBeginDate,"$到期日期$",strEndDate,"$注册人$",UserName,"","","","","",""
		
	END IF
	if strIfHaveMail="1" then
	%>
		<form name="form1" method="post" action="CreateVHost2.asp">
		<input type="hidden" name="ID" value="<%=PostID%>">
		<input type="hidden" name="VHID" value="<%=VHID%>">
		<font color=red>您已经完成支付,购买虚拟主机及邮局成功! <br>为保证系统正确建立邮局信息,请点击下面按钮再次确认!</font><br>
		<input type="submit" name="Submit" value="再次确认邮局购买信息" class="button">
		</form>
	<%
	else
	%>
		恭喜, 购买虚拟主机成功! 点击<a href="../../vhost/ViewVHostDetail.asp?ID=<%=VHID%>" class="a2">这里查看</a>
	<%
	end if
end if

Call PrintPageBottom
Cn.Close
%>

<%
Function FormatDate(iDate)
	FormatDate=DatePart("yyyy",iDate) & "-" & DatePart("m",iDate) & "-" & DatePart("d",iDate)
End Function
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -