<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunction.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
Dim CDNret
If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
elseIf session("canadmhostset")="" Then
	ef=True
	ec="您没有此操作的权限。"
end if
If Request.Form("id")="" Then
	ef=True
	ec="产品填号不存在。"
ElseIf Instr(1, Request.Form ("id"), "'", 1)>0 then
	ef=True
	ec="产品ID有非法字符！"
end if
If Request.Form ("auto")<>"" Then
If Request.Form ("HosttypeAuto")="" Then
	ef=True
	ec="请选择产品！"
ElseIf Request.Form ("endtimeauto")="" Then
	ef=True
	ec="请输入到期时间！"
end if
newhosttype=Request.Form ("HosttypeAuto")
end if

If Request.Form ("Submit")<>"" Then
If Request.Form ("spacelimit")="" Then
	ef=True
	ec="请输入大小限制！"
ElseIf Request.Form ("MaxConnections")="" Then
	ef=True
	ec="请输入IIS连接限制！"
ElseIf Request.Form ("AppPoolnum")="" Then
	ef=True
	ec="请输入应用程序池人数！"
'ElseIf Request.Form ("hostname")="" Then
'	ef=True
'	ec="请输入主机头名！"
ElseIf Request.Form ("endtime")="" Then
	ef=True
	ec="请输入到期时间！"
ElseIf Request.Form ("Hosttype")="" Then
	ef=True
	ec="请选择产品！"
end if
newhosttype=Request.Form ("Hosttype")
end if

if not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Host where id='"&Request.Form ("id")&"'"
	dsph.Open Sql,conn,1,3
if dsph.Eof then
	ef=True
	ec="产品填号在数据库中不存在。"
end if
end if

if not ef then
for ihname=1 to 15
for ihame2=1 to 15
if ihname<>ihame2 then
if lcase(trim(Request.Form ("hostname"&ihname)))=lcase(trim(Request.Form ("hostname"&ihame2))) and lcase(trim(Request.Form ("hostname"&ihame2)))<>"" and lcase(trim(Request.Form ("hostname"&ihname)))<>"" then
	ef=True
	ec="不能重复捆绑同一个域名!"
	exit for
end if
end if
next
next
end if

if not ef then
if request.Form("openmustre")="1" then
for ihname=1 to 15
if Request.Form ("hostname"&ihname)<>session("hostname"&ihname) and Request.Form ("hostname"&ihname)<>"" then'为新域名
'check domain in domaindb
'response.write 
status=""
if CheckDomainDB(replace(lcase(trim(Request.Form ("hostname"&ihname))),"http://",""))=false then
	ef=True
	ec="此域名 "&Request.Form ("hostname"&ihname)&" 没有通过备案，当前状态："&status&"，请到 http://www.miitbeian.gov.cn 查询是否成功备案。"
	If Application("beianupsaok")=True Then	ec="此域名 "&Request.Form ("hostname"&ihname)&" 尚未在工信部提交备案信息，当前状态："&status&"，请到先到 http://www.miitbeian.gov.cn 提交备案信息。"
end if
end if
next
end if
end if

if not ef then
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_USER where username='"&dsph ("username")&"'"
		ds.Open Sql,conn,1,3
if ds.eof then
	ef=True
	ec="用户不存在!"
end if
end if

if not ef then
	Set dshostold = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_HostProductlist where Hosttype='"&dsph ("Hosttype")&"'"
	dshostold.Open Sql,conn,1,1
if dshostold.Eof then
	ef=True
	ec="旧产品不存在！"
end if
end if

if not ef then
	Set dshost = Server.CreateObject("ADODB.Recordset")	
	'新产品类别
	Sql="Select * from FreeHost.FreeHost_HostProductlist where Hosttype='"&newhosttype&"'"
	dshost.Open Sql,conn,1,1
if dshost.Eof then
	ef=True
	ec="新的产品类型不存在！"
else

If IsNull(dsph("domaincount")) Then
domaincount=dshost("allowdomain")
Else
domaincount=dsph("domaincount")
End If

If trim(Request.Form ("hostname"&(domaincount+2)))<>"" Then
	ef=True
	ec="最多只允许设置"&domaincount&"个域名!"
end If
tdomain=domaincount
end if
end if


'if not ef then
'	Set dsserver = Server.CreateObject("ADODB.Recordset")	
'	Sql="Select * from FreeHost.FreeHost_Serverlist where id='"&dsph ("ServerlistID")&"'"
'	dsserver.Open Sql,conn,1,1
'if dsserver.Eof then
'	ef=True
'	ec="服务器不存在！"
'end if
'end If


if not ef then
	Set dsserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Serverlist where id='"&dsph ("ServerlistID")&"'"
	dsserver.Open Sql,conn,1,1
if dsserver.Eof then
	ef=True
	ec="服务器不存在！"
Else
    netby=dsserver("netby")
	ip=dsserver("ip")
	hostip=dsserver("ip")
	ftpdomain=dsserver("ftpdomain")
	ostype=dsserver("ostype")
hostip=dsserver("ip")
isuseCDN=dsserver("isuseCDN")	
usecdn1=dsserver("usecdn1")
usecdn2=dsserver("usecdn2")
usecdn3=dsserver("usecdn3")
usecdn4=dsserver("usecdn4")
usecdn5=dsserver("usecdn5")
CDNORIport=dsserver("port")
end if
end if

if not ef then
if isuseCDN=true then
	Set dsCDNserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_ServerCDNlist where id='"&dsserver ("usecdn1")&"'"
	dsCDNserver.Open Sql,conn,1,3
if dsCDNserver.Eof then
	ef=True
	ec="CDN服务器不存在！"
end if
end if
end if


if not ef then
'URL=dsserver("site")
'username=dsph("ftpname")
'hostname
':80:www.7i24.com,:80:7i24.com
for tempi=1 to abs(tdomain)+1
        if trim(Request.Form ("hostname"&tempi))<>"" then
        hostname=hostname&":80:"&replace(replace(Request.Form ("hostname"&tempi), " ",""),":80:","")&","
        end if
next
if right(hostname,1)="," then hostname=left(hostname,len(hostname)-1)
hostname=replace(hostname,"http://","")
hostname=replace(hostname,"　","")
hostname=lcase(hostname)
hostname_arry=Split(hostname, ",")
for i=0 to ubound(hostname_arry)
	Set dshostname = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Host where id<>'"&Request.Form ("id")&"' and hostname+',' like '%"&hostname_arry (i)&",%' and ServerlistID='"&dsserver("id")&"'"
	'response.write sql
	'	response.end
	dshostname.Open Sql,conn,1,1
if not dshostname.Eof then
	ef=True
	ec="您要绑定的域名"&replace(hostname_arry (i),":80:","")&"已存在，其他用户绑定了这个用户名，FTP是："&dshostname("ftpname")
end if
dshostname.close
Set dshostname = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Agent_ALLdomain where domain = '"&replace(hostname_arry (i),":80:","")&"'"
	dshostname.Open Sql,conn,1,1
if not dshostname.Eof then
	ef=True
	ec="您要绑定的域名"&replace(hostname_arry (i),":80:","")&"已存在,其他代理商在服务域名中绑定了这个域名！代理名是："&dshostname("username")
end if
dshostname.close
for iX=0 to ubound(Application("sitearry"))
if Application("sitearry")(iX)=replace(hostname_arry (i),":80:","") or Request.ServerVariables("LOCAL_ADDR")=replace(hostname_arry (i),":80:","") then
	ef=True
	ec="您要绑定的域名已存在C！"
exit for
end if
next
next



If hostname="" Then
	ef=True
	ec="请输入主机头名！"
end if
end if


if not ef then
if Application("autodelicp")=true then'如果启用后台检查
for ihname=1 to domaincount+1
if Request.Form ("hostname"&ihname)<>session("hostname"&ihname) and Request.Form ("hostname"&ihname)<>"" then'为新域名

domain=replace(lcase(trim(Request.Form ("hostname"&ihname))),"http://","")

domain=ComX.idntoac_7i24_com(cstr(domain))

	Set dsICPDB = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_ICPDB where domain='"&GetDomainMain(domain)&"'"
	dsICPDB.Open Sql,conn,1,3
if dsICPDB.Eof Then
dsICPDB.addnew
dsICPDB("username")=dsph("username")
dsICPDB("ftpname")=dsph("ftpname")
dsICPDB("domain")=domain
dsICPDB("status")="尚未检测"
dsICPDB("firstaddtime")=Now
dsICPDB("agent1")=dsph("agent1")
dsICPDB("agent2")=dsph("agent2")
dsph("alldomainok")=0
dsICPDB.update
end If
dsICPDB.close
end if
next
end if
end if

if not ef then
olduser_money=ds("usermoney")
oldtime=dsph ("endtime")
starttime=dsph ("endtime")
pdtype=dsph("Hosttype")
'数据库操作：
moneych=0
If Request.Form ("auto")<>"" Then
If dsph ("endtime")<>Request.Form ("endtimeauto") Then
dsph("emailstatus")=Null
dsph("smsstatus")=null
FreeHost_oplog session("admusername"),"信息","管理员修改虚拟主机，("&dsph ("Ftpname")&")原到期时间:"&dsph ("endtime")&"新到期时间:"&Request.Form ("endtimeauto")
dsph ("endtime")=Request.Form ("endtimeauto")
end if

If dsph ("starttime")<>Request.Form ("starttimeauto") Then
dsph ("starttime")=Request.Form ("starttimeauto")
end if

If dsph ("Hosttype")<>newhosttype Then'类型变更
typechange=True
FreeHost_oplog session("admusername"),"信息","管理员修改虚拟主机，("&dsph ("Ftpname")&")原类型:"&dsph ("Hosttype")&"新类型:"&Request.Form ("HosttypeAuto")
pdtype="原类型："&dsph ("Hosttype")&" 新类型："&Request.Form ("HosttypeAuto")

dsph ("Hosttype")=Request.Form ("HosttypeAuto")
If Request.Form ("chmoneyauto")<>"" Then
'变更金额
if Request.Form ("usermoneyauto")<>"" then'手工指定变更金额
ds("usermoney")=ds("usermoney")-Request.Form ("usermoneyauto")
moneych=-Request.Form ("usermoneyauto")

else'计算差价 自动变更

cost=DateDiff("d",NOW,dsph("endtime"))
if dsph("istest")="y" then  cost=0
cost=Clng(dshostold("usermoney")/365*cost)
if cost<0 then cost=0

'2008-9-19
costnew=DateDiff("d",NOW,dsph("endtime"))
if costnew<0 then costnew=0

cost=dshost("usermoney")/365*costnew-cost

ds("usermoney") =ds("usermoney") -cost
moneych=-cost

end if'完成变更金额

end if

else'类型相等

If cstr(oldtime)<>Cstr(Request.Form ("endtimeauto")) Then
if Request.Form ("usermoneyauto")<>"" then'手工指定变更金额
ds("usermoney")=ds("usermoney")-Request.Form ("usermoneyauto")
moneych=-Request.Form ("usermoneyauto")
end if
end if

end if
end if


If Request.Form ("Submit")<>"" Then
moneych=0
oldtime=dsph ("endtime")
If dsph ("endtime")<>Request.Form ("endtime") Then
FreeHost_oplog session("admusername"),"信息","管理员修改虚拟主机，("&dsph ("Ftpname")&")原到期时间:"&dsph ("endtime")&"新到期时间:"&Request.Form ("endtime")
dsph ("endtime")=Request.Form ("endtime")
dsph("emailstatus")=Null
dsph("smsstatus")=null
end if
If dsph ("Hosttype")<>newhosttype Then'类型变更
typechange=true
pdtype="原类型："&dsph ("Hosttype")&" 新类型："&Request.Form ("Hosttype")
FreeHost_oplog session("admusername"),"信息","管理员修改虚拟主机，("&dsph ("Ftpname")&")原类型:"&dsph ("Hosttype")&"新类型:"&Request.Form ("Hosttype")
dsph ("Hosttype")=Request.Form ("Hosttype")
If Request.Form ("chmoney")<>"" Then
'变更金额
if Request.Form ("usermoney")<>"" then'手工指定变更金额
ds("usermoney")=ds("usermoney")-Request.Form ("usermoney")
moneych=-Request.Form ("usermoney")
else'计算差价

cost=DateDiff("d",NOW,dsph("endtime"))
if dsph("istest")="y" then  cost=0
cost=Clng(dshostold("usermoney")/365*cost)
if cost<0 then cost=0
cost=dshost("usermoney")-cost
ds("usermoney") =ds("usermoney") -cost
moneych=-cost

end if
end if

else'类型相等

If cstr(oldtime)<>Cstr(Request.Form ("endtime")) Then
if Request.Form ("chmoney")<>"" then'手工指定变更金额
ds("usermoney")=ds("usermoney")-Request.Form ("usermoney")
moneych=-Request.Form ("usermoney")
end if
end if

end if
end if

newuser_money=ds("usermoney")
temptime=dsph ("endtime")
ds.update
if Request.Form ("istestch1")="y" or Request.Form ("istestch2")="y" then
dsph("status")="正常"
dsph("istest")="n"
FreeHost_oplog session("admusername"),"信息","管理员修改虚拟主机，("&dsph ("Ftpname")&") 将试用的改成正式的"
end if

If moneych<>0 Then FreeHost_moneyNewlog conn,"y","n","y","n","n",isAgnHostSer,-moneych,dsph ("username"),session("admusername"),dsph ("username"),olduser_money,newuser_money,agnusername,agnStmoney,agnEndmoney,session("admusername"),"管理员修改虚拟主机(FTP名"&dsph ("Ftpname")&")","管理员修改虚拟主机(FTP名"&dsph ("Ftpname")&")","虚拟主机",dsph("id"),pingzheng,type1,bank,haveget,havecheck

FreeHost_oplog session("admusername"),"信息","管理员完成修改虚拟主机操作,FTP用户名，("&dsph ("Ftpname")&")"

if dshost("isbydomain")="y" then
'送域名
	Set dspre = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Preopen_Product where byid='"&dsph("id")&"'"
	dspre.Open Sql,conn,1,3
if dspre.eof then
dspre.addnew
dspre("username")=ds("username")
dspre("haveget")="n"
dspre("byid")=dsph("id")
dspre("type1")=dshost("Domaintype")
dspre("whichProduct")="虚拟主机"
dspre("attime")=now
dspre("agent1")=ds("agent1")
dspre.update
dspre.close
set dspre=nothing
end if
end if


'送CDN
haveopenCDN=False
	Set dsCDNpdlist = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_CDNProductlist where id='"&dshost("CDNpdID")&"'"
	dsCDNpdlist.Open Sql,conn,1,1
if Not dsCDNpdlist.Eof Then
Set dsphCDN = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_CDN where username='"&dsph ("username")&"'"
	dsphCDN.Open Sql,conn,1,3
if Not dsphCDN.Eof Then
haveopenCDN=true
dsphCDN("endtime")=temptime
dsphCDN("status")="正常"
dsphCDN("kefu")=ds("kefunow")
dsphCDN.Update
End If
End If

'email
'开通邮箱

Set dsphemail = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Product_Email where byhost='"&dsph("id")&"' and username='"&dsph ("username")&"'"
	dsphemail.Open Sql,conn,1,3
if not dsphemail.Eof Then
dsphemail("starttime")=dsph ("starttime")
dsphemail("endtime")=temptime
if Request.Form ("istestch1")="y" or Request.Form ("istestch2")="y" then dsphemail("istest")="n"
dsphemail("status")="正常"
dsphemail.update
'FreeHost_oplog dsphemail("username"),"信息","管理员修改虚拟主机，("&dsph ("Ftpname")&")自动修改赠送邮箱ID:"&dsphemail("id")
retemail="赠送的邮箱产品已延期"
dsphemail.close
end if


'Sql
'开通邮箱

Set dsphSql = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Product_Sql where byhost='"&dsph("id")&"' and username='"&dsph ("username")&"'"
	dsphSql.Open Sql,conn,1,3
while not dsphSql.Eof
'if not dsphSql.Eof then
dsphSql("starttime")=dsph ("starttime")
dsphSql("endtime")=temptime
dsphSql("status")="正常"
if Request.Form ("istestch1")="y" or Request.Form ("istestch2")="y" then  dsphSql("istest")="n"
dsphSql.update
'FreeHost_oplog dsphSql("username"),"信息","管理员修改虚拟主机，("&dsph ("Ftpname")&")自动修改赠送数据库产品:"&dsphSql("id")
retSql="赠送的数据库产品已延期"
 dsphSql.movenext
wend
dsphSql.close


%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html8")%>
<%=htmlwrite("html9")%>
<TABLE width="100%" border=0 cellPadding=0 cellSpacing=0 background="img/midtop4.gif">
  <TBODY>
    <TR>
      <TD width=53 align="left" background="img/midtop1.gif"><strong> 　 </strong><font color="#FFFFFF">─<strong>&gt;</strong></font> </TD>
      <TD align="left"><table height="59"  border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="7" background="img/midtop.gif">&nbsp;</td>
          <td width="90" align="center" valign="middle" background="img/r3.jpg" id="tableTop1" style="Cursor:hand"><a href="admhost.asp"><font color="#FFFFFF"><strong>虚拟主机管理</strong></font></a></td>
          <td width="5" background="img/midtop2.gif">&nbsp;</td>
        </tr>
      </table></TD>
      <TD width="83">&nbsp;</TD>
      <TD width="83" align="left">&nbsp;</TD>
      <TD align="left">&nbsp;</TD>
      <TD width=23 align="right"><IMG height=59 
                  src="img/rtop4.jpg" 
                  width=19></TD>
    </TR>
  </TBODY>
</TABLE>
<TABLE width="100%" border=0 cellPadding=0 cellSpacing=0>
  <TBODY>
    <TR>
      <TD width=19 background="img/midlef.gif" id=rightid>&nbsp;</TD>
      <TD height="300" align="center" vAlign=top bgcolor="#FFFFFF">
<table width="65%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
	<br>
<DIV class="tableborder"><br>
<br>
受控端返回信息：
<%
'调用开通function


dsph("hostname")=hostname
dsph.update

AccessFlags=1
if dshost("asp")="y" then
AccessFlags=513
ScriptMaps=dsserver("asp") 
end if

if dshost("aspx")="y" then
AccessFlags=513
netver=dsserver("netver")
If Not IsNull(dshost("netver")) Then netver=dshost("netver")
If netver="1.1" Then ScriptMaps=ScriptMaps&"|"&dsserver("aspx") 
If netver="2.0" Then ScriptMaps=ScriptMaps&"|"&dsserver("aspx2") 
If netver="4.0" Then ScriptMaps=ScriptMaps&"|"&dsserver("aspx4") 
dsph("netver")=netver
end If

if dshost("cgi")="y" then
AccessFlags=517
ScriptMaps=ScriptMaps&"|"&dsserver("cgi") 
end if
if dshost("php")="y" then
AccessFlags=513
ScriptMaps=ScriptMaps&"|"&dsserver("php") 
end If
if dsph("notuserar")="y" then
ScriptMaps=ScriptMaps&"|"&dsserver("notuserar") 
end if
if dsserver("infosafe")<>"" And AccessFlags>1 then
ScriptMaps=ScriptMaps&"|"&dsserver("infosafe") 
end if
ScriptMaps=trim(replace(ScriptMaps,"||","|"))

URL=dsserver("site")
FreeHostsharekey=dsserver("FreeHostsharekey")
username=dsph ("Ftpname")
password=dsph("Ftppassword")
comment=dsph ("username")
'homedir=Request.Form("homedir")

homedir=dsserver("homedir")

If typechange Then
spacelimit=dshost ("spacelimt")'类型变更'---------------------------------------
MaxConnections=dshost("MaxConnections")
EnumAppsInPool=dshost ("AppPoolnum")
MaxBandwidth=dshost("MaxBandwidth")
end If

If typechange or CInt(Request.Form ("AppPoolnum"))<>dsph ("AppPoolnum") Then
AppPoolnumCh=True
Else
AppPoolnumCh=false
End if

starttime=dsph("starttime")
endtime=dsph("endtime")
type1=dsph("Hosttype")
email=ds("email")
host=dsph("hostname")
hostcomment_arry=Split(dsph("hostname"), ",")
hostcomment=Replace(hostcomment_arry(0),":80:","")&"_"&username&"_"&dsph ("username")


DefaultDoc=Request.Form ("DefaultDoc")
if trim(Request.Form ("ScriptMaps"))<>"" then
ScriptMaps=trim(Request.Form ("ScriptMaps"))&"|"&dsserver("infosafe")
ScriptMaps=trim(replace(ScriptMaps,"||","|"))
end if

AccessFlags=Request.Form ("AccessFlags")
LogFileDirectory=Request.Form ("LogFileDirectory")
HttpErrors=Request.Form ("HttpErrors")



If Request.Form ("Submit")<>"" Then
if Request.Form ("spacelimit")<>"" and not (Request.Form ("istestch1")="y" or Request.Form ("istestch2")="y") then spacelimit=Request.Form  ("spacelimit")
if Request.Form ("MaxConnections")<>"" and not (Request.Form ("istestch1")="y" or Request.Form ("istestch2")="y") then MaxConnections=Request.Form  ("MaxConnections")
if Request.Form ("AppPoolnum")<>"" then EnumAppsInPool=Request.Form  ("AppPoolnum")
if Request.Form ("MaxBandwidth")<>"" and not (Request.Form ("istestch1")="y" or Request.Form ("istestch2")="y") then MaxBandwidth=Request.Form ("MaxBandwidth")
end if
hostname=host
 
hostnamestr=replace(hostname, ":80:","")
hostname_arry=Split(hostnamestr, ",")
for i=0 to ubound(hostname_arry)
hostname_arry(i)=ComX.idntoac_7i24_com(cstr(hostname_arry(i)))
next
hostname=""
for i=0 to ubound(hostname_arry)
hostname=hostname&":80:"&replace(replace(hostname_arry(i), " ",""),":80:","")&","
next
if right(hostname,1)="," then hostname=left(hostname,len(hostname)-1)
dsph("hostname")=hostname
dsph.update
host=hostname


if Request.Form ("istestch1")="y" then
MaxConnections=dshost ("MaxConnections")
spacelimit=dshost ("spacelimt")
MaxBandwidth=dshost("MaxBandwidth")
end if

dsph("spacelimt")=spacelimit
dsph("MaxConnections")=MaxConnections
dsph("MaxBandwidth")=MaxBandwidth
dsph("AppPoolnum")=EnumAppsInPool

dsph("Maxbytes")=dshost("Maxbytes")
dsph("MaxCPU")=dshost("MaxCPU")

If dsph("allowsub")="n" then
dsph("allowsub")=dshost("allowsub")
dsph("subweb")=dshost("subweb")
dsph("useper")=100
Else
dsph("subweb")=dshost("subweb")
End if

dsph("canseelog")=dshost("canseelog")
'dsph("canrar")=dshost("canrar")
'dsph("canback")=dshost("canback")
'dsph("canrecypool")=dshost("canrecypool")
'dsph("canchnetver")=dshost("canchnetver")
'dsph("notuserar")=dshost("notuserar")

if dsserver("iisver")>6 Then
hostnamestr=replace(host, ":80:","")
hostname_arry=Split(hostnamestr, ",")
for i=0 to ubound(hostname_arry)
hostname_arry(i)=ComX.actoidc_7i24_com(cstr(hostname_arry(i)))
next
hostname=""
for i=0 to ubound(hostname_arry)
hostname=hostname&":80:"&replace(replace(hostname_arry(i), " ",""),":80:","")&","
next
if right(hostname,1)="," then hostname=left(hostname,len(hostname)-1)
host=hostname
End if

if Application("hostoneip")=true Then

If Request("nullhead")="1" Then
dsph("nullhead")=1
Else
dsph("nullhead")=0
End If

If Request("iphead")="1" Then
dsph("iphead")=1
Else
dsph("iphead")=0
End If


If request("ipid")<>"" then
 conn.Execute "update FreeHost.FreeHost_Product_Host_IP set HostID=0 where HostID="&dsph("id")
 conn.Execute "update FreeHost.FreeHost_Product_Host_IP set HostID="&dsph("id")&" where ID="&request("ipid")
Set dsX = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Product_Host_IP where HostID="&dsph("id")
		dsX.Open Sql,conn,1,1
If not dsX.Eof Then
host=Replace(host,":80:",dsX("IP")&":80:")
'特有内容:
If dsph("iphead")=true then host=dsX("IP")&":80:"&dsX("IP")&","&host
If dsph("nullhead")=true Then host=dsX("IP")&":80:,"&host
End if
End If



End if

 dsph("AppPoolnum")=EnumAppsInPool
If EnumAppsInPool="" Then dsph("AppPoolnum")=dshost("AppPoolnum")'2011
dsph.update

If Not IsNull(dsph("CurPoolname")) And AppPoolnumCh=true Then
dsph("CurPoolname")=Null
dsph.update
If EnumAppsInPool="" Then EnumAppsInPool=dshost("AppPoolnum")
response.write "池数量变更,重算池分配."
'新的受控
CurPoolname=dsph("AppPoolnum")&"_FreeHost_1"
Curpoolid=1
haneemptypool=False
	Set dsPooldist = Server.CreateObject("ADODB.Recordset")	
Sql="Select distinct CurPoolname from FreeHost.FreeHost_Product_Host where serverlistid='"&dsph("ServerlistID")&"' and hosttype<>'子目录绑定' and AppPoolnum='"&EnumAppsInPool&"' and CurPoolname is not null and CurPoolname like '"&EnumAppsInPool&"_F%' order by CurPoolname Asc"
	dsPooldist.Open Sql,conn,1,1
'	response.write sql
If dsPooldist.Eof Then haneemptypool=true'一个这样的池也没有
Do Until dsPooldist.Eof
CurPoolname=dsPooldist("CurPoolname")
If CInt(Replace(CurPoolname,dsph("AppPoolnum")&"_FreeHost_",""))>Curpoolid Then Curpoolid=CInt(Replace(CurPoolname,dsph("AppPoolnum")&"_FreeHost_",""))
'response.write "<br>"&CurPoolname&"<br>"
Set dsCurPcount = Server.CreateObject("ADODB.Recordset")	
Sql="Select count(*) from FreeHost.FreeHost_Product_Host where serverlistid='"&dsph("ServerlistID")&"' and hosttype<>'子目录绑定' and CurPoolname='"&CurPoolname&"'"
	dsCurPcount.Open Sql,conn,1,1
'	response.write dsCurPcount(0)&"<br>"
	If dsCurPcount(0)<CInt(EnumAppsInPool) Then'池没装完
	If dsCurPcount(0)>0 Then CurPoolname=dsPooldist("CurPoolname")'池名不变
	haneemptypool=true
	Exit do
	End if
	dsCurPcount.close
dsPooldist.movenext
loop
dsPooldist.close
if haneemptypool=False Then CurPoolname=EnumAppsInPool&"_FreeHost_"&CStr(Curpoolid+1)
dsph("CurPoolname")=CurPoolname
dsph.update
End If


if isuseCDN=true Then host=Replace(host,":80:",":"&CDNORIport&":")
'Response.Write host
If Not IsNull(dsph("CurPoolname")) Then
outpoolname=dsph("CurPoolname")
op=1
outtemp="新受控"&ModifyUser3(URL,FreeHostsharekey,username,comment,homedir,spacelimit,starttime,endtime,type1,type2,type3,email,host,hostcomment,MaxConnections,EnumAppsInPool,DefaultDoc,ScriptMaps,AccessFlags,LogFileDirectory,HttpErrors,MaxBandwidth,outpoolname,op)
else
outtemp=ModifyUser2(URL,FreeHostsharekey,username,comment,homedir,spacelimit,starttime,endtime,type1,type2,type3,email,host,hostcomment,MaxConnections,EnumAppsInPool,DefaultDoc,ScriptMaps,AccessFlags,LogFileDirectory,HttpErrors,MaxBandwidth)
End if



Response.Write Replace(replace(outtemp,",:","<br>:"),host,"成功")



'处理子目录绑定
Set dsphsub = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Host where allowsubbyid='"&dsph("id")&"'"
	dsphsub.Open Sql,conn,1,3
while not dsphsub.eof
'IISID=dsphsub("IISID")
'op=0
'Response.Write PauseSiteSub(URL,FreeHostsharekey,IISID,tourl,op)
'dsphsub("status")="正常"
dsphsub("endtime")=temptime
dsphsub.update
dsphsub.movenext
wend
dsphsub.close



%><br>
<br>

</div>
	
	</td>
  </tr>
</table>

<br>
<table width="65%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
	
	
	<br><DIV class="tableborder">
<table width="100%"  border="0" align="center" cellpadding="2" cellspacing="1">
  <tr align="center" bordercolor="#000000" bgcolor="#999999">
    <td height="24" colspan="4" background="img/tablebg.gif"><font color="#990000"><font color="#FFFFFF">虚拟主机修改成功，以下是相关的资料</font></font></td>
  </tr>
  <tr bordercolor="#000000" bgcolor="#E4EAF2">
    <td width="53%" height="30"><font color="#000000"> 　　　 用户的原金额：</font></td>
    <td width="47%" colspan="3"><font color="#000000"><%=olduser_money%> 元</font></td>
  </tr>
  <tr bordercolor="#000000" bgcolor="#E4EAF2">
    <td height="41"><font color="#000000">　　　 用户的金额变化：</font></td>
    <td colspan="3"><font color=red><%=moneych%></font><font color=#FF0000> 元</font></td>
  </tr>
  <tr bordercolor="#000000" bgcolor="#E4EAF2">
    <td height="39"><font color="#000000">　　　 用户的新金额：</font></td>
    <td colspan="3"><font color="#000000"><%=newuser_money%> 元</font></td>
  </tr>
  <tr bordercolor="#000000" bgcolor="#E4EAF2">
    <td height="37"><font color="#000000">　　　 FTP登陆用户名是：</font></td>
    <td colspan="3"><%=username%></td>
  </tr>
  <tr bordercolor="#000000" bgcolor="#E4EAF2">
    <td height="37"><font color="#000000"> 　　　 FTP密码是：</font></td>
    <td colspan="3"><%=password%></td>
  </tr>
  <tr bordercolor="#000000" bgcolor="#E4EAF2">
    <td height="42" colspan="4"><font color="#000000">　　　 </font><font color="#000000">用户的网址为：</font><font color="#000000"><a href="http://<%=Replace(hostcomment_arry(0),":80:","")%>" target=_blank><font color="#000000">http://<%=Replace(hostcomment_arry(0),":80:","")%></font></a></font></td>
  </tr>
  <tr bordercolor="#000000" bgcolor="#E4EAF2">
    <td height="40" colspan="4"><font color="#000000"> 　　　 用户的FTP地址是：<font color=red><%=ftpdomain%></font></font></td>
  </tr>
  <tr bordercolor="#000000" bgcolor="#E4EAF2">
    <td height="37"><font color="#000000"> 　　　 原来的到期时间是:</font></td>
    <td colspan="3"><font color="#000000"><%=oldtime%></font></td>
  </tr>
  <tr bordercolor="#000000" bgcolor="#E4EAF2">
    <td height="37"><font color="#000000"> 　　　 现在的到期时间是:</font></td>
    <td colspan="3"><%=temptime%></td>
  </tr>
  <tr bordercolor="#000000" bgcolor="#E4EAF2">
    <td height="37"><font color="#000000"> 　　　 目前此虚拟主机状态是：</font></td>
    <td colspan="3"><%=dsph("status")%></td>
  </tr>
  <tr bordercolor="#000000" bgcolor="#E4EAF2">
    <td height="37"><font color="#000000"> 　　　 更新虚拟主机的状态：</font></td>
    <td colspan="3"><form name="form1" method="post" action="handhost2.asp">
        <input type="submit" name="Submit" value="暂停">
        <input type="submit" name="Submit" value="恢复">
        <input name="pauseweb" type="hidden" value="pauseweb3">
        <input name="username" type="hidden" value="<%=dsph("username")%>">
        <input name="id" type="hidden" value="<%=dsph("id")%>">
    </form></td>
  </tr>
  <tr bordercolor="#000000" bgcolor="#E4EAF2">
    <td height="37" colspan="4" align="right" bgcolor="#E4EAF2"><font color="#000000"> 　　　</font><a href="#top"><font color="#6B9EDE" face="Arial, Helvetica, sans-serif">Top↑</font></a>	</td>
    </tr>


</table>
	</div>
<%

dsph.Update

CDNrefreshDomain'更新CDN
response.write CDNret


dsph.close


%>
	
	
	</td>
  </tr>
</table>

</TD>
      <TD width=18 background="img/midri.gif">&nbsp;</TD>
    </TR>
  </TBODY>
</TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
    <TR>
      <TD width=30><IMG height=19 
                  src="img/rb1.jpg" 
                  width=30></TD>
      <TD 
                background=img/rb2.jpg>&nbsp;</TD>
      <TD width=30><IMG height=19 
                  src="img/rb3.jpg" 
                  width=30></TD>
    </TR>
  </TBODY>
</TABLE>
<%=htmlwrite("html10")%>
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
