AC论坛 - www.29ac.cnVIP
2020-06-29发布于“ASP学习相关文章”
关注
ASP的一个问题】源代码:

<%If Not ef Then
If Request("action")="activate" then



session("username")=Sagent("username")
session("agentname")=Sagent("username")
session("agenttype")=Sagent("agenttype")
session("atspace")="API区"
if session("agentname")=session("username") then
session("AgnRunasUser")=True
else
session("AgnRunasUser")=false
end if
'登陆API区





if not ef Then
vpsname=LCase(Trim(Request ("vpsname")))
VPSpassword=Trim(Request ("VPSpassword"))
HostListpdid=Request ("productid")
ReqServerlistID=CStr(Request("idc"))
If Request("idc")="" Then ReqServerlistID="0"
If vpsname="" Then vpsname=Left(md5(now&"7i24.com"&now),8)
If VPSpassword="" Then VPSpassword=Left(md5(now&"7i24.com"),8)
End If


If session("username")="" Then
	ef=True
	ec="授权非法,有可能是超时造成的。"
ElseIf Request ("productid")="" Then
	ef=True
	ec="请选择产品!"
ElseIf not IsNumeric(Request ("productid"))  Then
	ef=True
	ec="产品ID应该是数字!"
ElseIf IsNumeric(vpsname)  Then
	ef=True
	ec="云服务器名不能是纯数字!"
ElseIf not IsNumeric(HostListpdid)  Then
	ef=True
	ec="产品ID应该是数字!"
ElseIf not IsNumeric(ReqServerlistID)  Then
	ef=True
	ec="机房ID应该是数字!"
ElseIf not IsNumeric(Request ("year"))  Then
	ef=True
	ec="时间应该是数字!"
ElseIf vpsname="" Then
	ef=True
	ec="请设置云服务器名!"
ElseIf Len(vpsname)<3 Then
	ef=True
	ec="云服务器名长度不能小于3位!"
ElseIf Trim(LCase(vpsname))="self" or Trim(LCase(vpsname))="adm" Or Trim(LCase(vpsname))="administrator" Or Trim(LCase(vpsname))="freehost" Or Trim(LCase(vpsname))="proxy" Then
	ef=True
	ec="您输入的VPS户名为保留用户名,请换一个云服务器名"
ElseIf RegExpTest("[^A-Za-z0-9]",vpsname) Then
	ef=True
	ec="云服务器名中有非法字符!"
ElseIf RegExpTest("[^A-Za-z0-9]",VPSpassword) Then
	ef=True
	ec="云服务器密码中有非法字符!"
end If

if not ef then
if DateDiff("s", Application("hostoptime"),NOW )<180 and Application("hostoplock")=true then
	ef=True
	ec="系统繁忙,前一个网站开通操作尚未处理完,请您稍等两分钟后再试,谢谢您的支持。"
end if
end if

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

'if not ef then
'if ds("password")<>session("password") then
'	ef=True
'	ec="密码不正确!"
'end if
'end if

if not ef then
	Set dshost = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_VPSProductlist where id='"&HostListpdid&"'"
	dshost.Open Sql,conn,1,1
if dshost.Eof then
	ef=True
	ec="产品不存在!"
Else
If dshost ("isagentpd")=True Then isagentpd=true'代理的产品
ServerlistID=dshost ("ServerlistID")'机房选择
if  ReqServerlistID=cstr(dshost ("ServerlistID2")) and dshost ("ServerlistID2")<>0 then ServerlistID=dshost ("ServerlistID2")
if  ReqServerlistID=cstr(dshost ("ServerlistID3")) and dshost ("ServerlistID3")<>0 then ServerlistID=dshost ("ServerlistID3")
if  ReqServerlistID=cstr(dshost ("ServerlistID4")) and dshost ("ServerlistID4")<>0 then ServerlistID=dshost ("ServerlistID4")
if  ReqServerlistID=cstr(dshost ("ServerlistID5")) and dshost ("ServerlistID5")<>0 then ServerlistID=dshost ("ServerlistID5")

if  ReqServerlistID=cstr(dshost ("ServerlistID6")) and dshost ("ServerlistID6")<>0 then ServerlistID=dshost ("ServerlistID6")
if  ReqServerlistID=cstr(dshost ("ServerlistID7")) and dshost ("ServerlistID7")<>0 then ServerlistID=dshost ("ServerlistID7")
if  ReqServerlistID=cstr(dshost ("ServerlistID8")) and dshost ("ServerlistID8")<>0 then ServerlistID=dshost ("ServerlistID8")
if  ReqServerlistID=cstr(dshost ("ServerlistID9")) and dshost ("ServerlistID9")<>0 then ServerlistID=dshost ("ServerlistID9")
if  ReqServerlistID=cstr(dshost ("ServerlistID10")) and dshost ("ServerlistID10")<>0 then ServerlistID=dshost ("ServerlistID10")

if ds("agent1")<>"n" then
	Set agnserverid = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_VPSProductlist_AGN where id='"&HostListpdid&"' and agent1='"&ds("agent1")&"'"
	agnserverid.Open Sql,conn,1,1
dim isAgnHostSer
if not agnserverid.Eof Then
If agnserverid("isagentpd")=True Then isagentpd=true'代理的产品
if agnserverid ("ServerlistID")<>0 then
ServerlistID=agnserverid ("ServerlistID")
isAgnHostSer=true
else
isAgnHostSer=false
end if
end if
end if'isagn
end if
end If

'Response.write ReqServerlistID&ServerlistID
'Response.end
if not ef then
if dshost("cancloud")=false And Request ("CpuValue")<>"" then
	ef=True
	ec="本产品不允许弹性购买"'&Request ("CpuValue")&":"&dshost("cancloud")
end if
end If

if not ef then
if dshost("cancloud")=true then'是弹性购买产品
If not IsNumeric(Request ("CpuValue"))  Then
	ef=True
	ec="CPU应该是数字!"
ElseIf CInt(Request ("CpuValue"))<1 Then
	ef=True
	ec="CPU不能小于1个核心!"
ElseIf not IsNumeric(Request ("RamValue"))  Then
	ef=True
	ec="RAM应该是数字!"
ElseIf CInt(Request ("RamValue"))<256 Then
	ef=True
	ec="内存不能小于256M!"
ElseIf not IsNumeric(Request ("VHDValue"))  Then
	ef=True
	ec="虚拟硬盘大小应该是数字!"
ElseIf CInt(Request ("VHDValue"))<10 Then
	ef=True
	ec="虚拟硬盘大小不能小于10G!"
ElseIf not IsNumeric(Request ("MbpsValue"))  Then
	ef=True
	ec="带宽大小应该是数字!"
ElseIf CInt(Request ("MbpsValue"))<1 Then
	ef=True
	ec="带宽不能小于1Mbps!"
ElseIf not IsNumeric(Request ("SNAValue"))  Then
	ef=True
	ec="快照数量应该是数字!"
ElseIf CInt(Request ("SNAValue"))<0 Then
	ef=True
	ec="快照不能小于0个!"
ElseIf not IsNumeric(Request ("BakValue"))  Then
	ef=True
	ec="备份数量应该是数字!"
ElseIf CInt(Request ("BakValue"))<0 Then
	ef=True
	ec="备份不能小于0个!"
ElseIf not IsNumeric(Request ("NGBValue"))  Then
	ef=True
	ec="流量上限应该是数字!"
ElseIf CInt(Request ("NGBValue"))<0 Then
	ef=True
	ec="流量上限不能小于0个!"
ElseIf not IsNumeric(Request ("IPValue"))  Then
	ef=True
	ec="IP上限应该是数字!"
ElseIf CInt(Request ("IPValue"))<1 Then
	ef=True
	ec="IP上限不能小于1个!"
ElseIf not IsNumeric(Request ("IopsValue"))  Then
	ef=True
	ec="IOPS上限应该是数字!"
ElseIf CInt(Request ("IopsValue"))<0 Then
	ef=True
	ec="IOPS上限不能小于1个!"
ElseIf not IsNumeric(Request ("OSAllList"))  Then
	ef=True
	ec="操作系统ID应该是数字!"
ElseIf CInt(Request ("OSAllList"))<1 Or CInt(Request ("OSAllList"))>25 Then
	ef=True
	ec="操作系统ID不能小于1或大于25!"
end If
end if
end If

if not ef then
If Request ("year")<>999 and Request ("year")<>dshost("PAY_DAY") and Request ("year")<>dshost("PAY_WEEK") and Request ("year")<>dshost("PAY_Month") and Request ("year")<>dshost("PAY_Season")  and Request ("year")<>dshost("PAY_halfyear") and Request ("year")<>1 and Request ("year")<>dshost("PAY_2year") and Request ("year")<>dshost("PAY_3year") and Request ("year")<>dshost("PAY_4year") and Request ("year")<>dshost("PAY_5year") Then
	ef=True
	ec="请选择时间!"
end If
end if

if not ef then
if dshost("usermoney")=0 then
	Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_VPS where username='"&session("username")&"'"
	dsph.Open Sql,conn,1,1
if not dsph.Eof then
	ef=True
	ec="金额为零的产品,一个用户只能申请一个!"
end if
dsph.close
end if
end if

if not ef then
if Not IsNull(dshost("onlyusebyagn")) Then
If session("agentname")<>dshost("onlyusebyagn") then
	ef=True
	ec="本产品只允许特定的代理使用!"
End if
end if
end If

if not ef then
if dshost("canbyenduser")="n" And session("agentname")="n" then
	ef=True
	ec="本产品不允许最终用户开通!"
end if
end If

if not ef then
if dshost("canbyagnenduser")="n" And session("agentname")<>"n" then
	ef=True
	ec="本产品不允许用户开通!"
end if
end If

if not ef then
if dshost("canbyagn")="n" And session("AgnRunasUser")=true then
	ef=True
	ec="本产品不允许代理开通!"
end if
end if

if not ef then
if Request ("year")=999 and dshost("cantest")="n" then
	ef=True
	ec="很抱歉,本产品不可以试用!"
end if
end If

if not ef then
if Request ("year")=999 and Application("vpscantest")=True And ds("usermoney")<0.01 then
	ef=True
	ec="很抱歉,余款为零的用户不可以试用!"
end if
end If

if not ef then
if Request ("year")=999 and (Hour(now)<Application("vpscantestST") or Hour(now)>Application("vpscantestEN"))then
	ef=True
	ec="很抱歉,现在的时间段不可以试用!"
end if
end If

if not ef then
if Request ("year")=dshost("PAY_DAY") and dshost("canday")="n" then
	ef=True
	ec="很抱歉,本产品不可以日付!"
end if
end If

if not ef then
if Request ("year")=dshost("PAY_WeeK") and dshost("canweek")="n" then
	ef=True
	ec="很抱歉,本产品不可以周付!"
end if
end If

if not ef then
if Request ("year")=dshost("PAY_Month") and dshost("canmonth")="n" then
	ef=True
	ec="很抱歉,本产品不可以月付!"
end if
end if
if not ef then
if Request ("year")=dshost("PAY_Season") and dshost("canseason")="n" then
	ef=True
	ec="很抱歉,本产品不可以季付!"
end if
end if
if not ef then
if Request ("year")=dshost("PAY_halfyear") and dshost("canhalfyear")="n" then
	ef=True
	ec="很抱歉,本产品不可以半年付!"
end if
end if


'IP黑名单检查
for iX=0 to ubound(Application("blockiparry"))
lenip=Len(Application("blockiparry")(iX))
If lenip>4 then

if Application("blockiparry")(iX)=Left(Request.ServerVariables("REMOTE_ADDR"),lenip) then
	ef=True
	ec="您的IP或IP段"&Request.ServerVariables("REMOTE_ADDR")&"属于黑名单IP:"&Application("blockiparry")(iX)&"@,不允许开通!"
exit for
end If

End if
Next

If Not isagentpd then'不是代理产品时再执行
if not ef then
	Set dsserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_ServerVPSlist where id='"&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")
end if
end If

if not ef Then
If dsserver("IsError")=true Then
	ef=True
	ec="很抱歉,您选取的服务器的处于离线状态"
End if
end If

if not ef then
if dshost("canADSL")=True then
Set dsVPSADSL = Server.CreateObject("ADODB.Recordset")	
		Sql="Select count(*) from FreeHost.FreeHost_Product_VPS_ADSL where  errorADSLCode is null and ServerlistID="&dsserver("id")&""
		dsVPSADSL.Open Sql,conn,1,1
If dsVPSADSL(0)<1 Then
	ef=True
	ec="很抱歉,您选取的服务器的云服务器拨号资源已用光,请联系管理员处理."'&sql
End If
dsVPSADSL.close
End If
End If

'检查IP资源
if not ef Then
Set dsVPSip = Server.CreateObject("ADODB.Recordset")	
		Sql="Select count(*) from FreeHost.FreeHost_Product_VPS_IP where ServerlistID="&dsserver("id")&" and VPSID=0"
		dsVPSip.Open Sql,conn,1,1
If dsVPSip(0)=0 Then
If dsserver("IP_AREA")>0 Then'
Set dsVPSip = Server.CreateObject("ADODB.Recordset")	
		Sql="Select count(*) from FreeHost.FreeHost_Product_VPS_IP where IP_AREA="&dsserver("IP_AREA")&" and VPSID=0"'2018 IP池
		dsVPSip.Open Sql,conn,1,1
If dsVPSip(0)=0 Then
	ef=True
	ec="很抱歉,您选取的服务器所在的IP池资源已用光,管理员尚未分配可用IP,请联系管理员处理."
Else
IsUse_IP_AREA=True
End if
Else
	ef=True
	ec="很抱歉,您选取的服务器的当前的IP资源已用光,管理员尚未分配可用IP,请联系管理员处理."
End if
End If
if dshost("cancloud")=true then'是弹性购买产品
If dsVPSip(0)<CInt(Request.Form ("IPValue")) Then

If dsserver("IP_AREA")>0 Then'
Set dsVPSip = Server.CreateObject("ADODB.Recordset")	
		Sql="Select count(*) from FreeHost.FreeHost_Product_VPS_IP where IP_AREA="&dsserver("IP_AREA")&" and VPSID=0"'2018 IP池
		dsVPSip.Open Sql,conn,1,1
If dsVPSip(0)<CInt(Request.Form ("IPValue")) Then
	ef=True
	ec="很抱歉,您选取的服务器所在的弹性IP池资源已用光,管理员尚未分配可用IP,请联系管理员处理."
Else
IsUse_IP_AREA=True
End if
Else
	ef=True
	ec="很抱歉,您选取的服务器的当前的弹性IP资源已用光,管理员尚未分配可用IP,请联系管理员处理."'&Request.Form ("IPValue")&dsVPSip(0)
End If
End If
End If
End If


'检查内存有没有用光
if not ef then
Set dsVPSMax = Server.CreateObject("ADODB.Recordset")	
		Sql="Select sum(maxram) from FreeHost.FreeHost_Product_VPS where ServerlistID="&dsserver("id")&""
		dsVPSMax.Open Sql,conn,1,1
If (dsVPSMax(0)+dshost("MaxRAM"))>dsserver("maxram") Then
	ef=True
	ec="很抱歉,您选取的服务器的内存资源已用光,请联系管理员处理."
End If
if dshost("cancloud")=true then'是弹性购买产品
If dsVPSMax(0)+Request ("RamValue")>dsserver("maxram") Then
	ef=True
	ec="很抱歉,您选取的服务器的内存资源已用光,请联系管理员处理."
End If
End If
dsVPSMax.close
End If

'检查显卡GPU内存有没有用光
if not ef Then
if dshost("canGPU")=true then'是GPU
Set dsVPSMax = Server.CreateObject("ADODB.Recordset")	
		Sql="Select sum(MAXRAMGPU) from FreeHost.FreeHost_Product_VPS where ServerlistID="&dsserver("id")&""
		dsVPSMax.Open Sql,conn,1,1
If (dsVPSMax(0)+dshost("MAXRAMGPU"))>dsserver("MAXRAMGPU") Then
	ef=True
	ec="很抱歉,您选取的服务器的显卡GPU内存资源已用光,请联系管理员处理."
End If
'if dshost("cancloud")=true then'是弹性购买产品
'If dsVPSMax(0)+Request ("MAXRAMGPU")>dsserver("MAXRAMGPU") Then
'	ef=True
'	ec="很抱歉,您选取的服务器的内存资源已用光,请联系管理员处理."
'End If
'End If
dsVPSMax.close
End If
End If

'检查space有没有用光
if not ef then
Set dsVPSMax = Server.CreateObject("ADODB.Recordset")	
		Sql="Select sum(Maxspace) from FreeHost.FreeHost_Product_VPS where ServerlistID="&dsserver("id")&""
		dsVPSMax.Open Sql,conn,1,1
If dsVPSMax(0)+dshost("Maxspace")>dsserver("Maxspace") Then
	ef=True
	ec="很抱歉,您选取的服务器的硬盘资源已用光,请联系管理员处理."
End If
if dshost("cancloud")=true then'是弹性购买产品
If dsVPSMax(0)+Request ("VHDValue")>dsserver("Maxspace") Then
	ef=True
	ec="很抱歉,您选取的服务器的硬盘资源已用光,请联系管理员处理."
End If
End If
dsVPSMax.close
End If

if not ef then
Set dsVPSMax = Server.CreateObject("ADODB.Recordset")	
		Sql="Select count(*) from FreeHost.FreeHost_Product_VPS where ServerlistID="&dsserver("id")&""
		dsVPSMax.Open Sql,conn,1,1
If dsVPSMax(0)+1>dsserver("MaxVPS") Then
	ef=True
	ec="很抱歉,您选取的服务器的VPS数量资源已用光,请联系管理员处理."
End If
dsVPSMax.close
End if





if not ef then
	Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_VPS where vpsname='"&trim(vpsname)&"'"
	dsph.Open Sql,conn,1,3
if not dsph.Eof then
	ef=True
	ec="您输入的云服务器名已存在,请另外输入一个!"
end if
'dsph.close
end if

if not ef Then
If dsserver("RAMUsePer")>dsserver("RAMUsePerLIM") Then
	ef=True
	ec="您所选的节点负荷(内存)太重,建议您另选一台."
End if
end If

if not ef then
URL=dsserver("site")
FreeHostsharekey=dsserver("FreeHostsharekey")
temp=VPSOP(URL,FreeHostsharekey,"list all now",0)
if instr(temp,"名称: "&LCase(trim(vpsname)))>0 Then
	ef=True
	ec="服务器上已存在同名的VPS,请您联系管理员处理,或换一个云服务器名重试。"
End if
if not instr(temp,"成功")>1 Or instr(temp,"失败")>1 Then
	ef=True
	ec="系统暂时不可用,请联系管理员在管理区自检来了解原因,也可以稍后再试。"
end if
end If

'if not ef then
'Set dsph = Server.CreateObject("ADODB.Recordset")	
'	Sql="Select * from FreeHost.FreeHost_Product_VPS where username='"&session ("username")&"' and istest='y'"
'	dsph.Open Sql,conn,1,3
'if Request ("year")=999 then
'if not dsph.Eof then
'	ef=True
'	ec="一个用户只能试用一个产品!"
'end if
'end if
'end If

if not ef then
if Request ("year")=999 And dshost("cantest")="n" and Application("Agentcantest")=false then
	ef=True
	ec="很抱歉,管理员设置为不能设为试用!"
end if
end if

if not ef then
If dsserver("OStype")="Windows 2008R2" And dshost("Cpunum")>4 Then
	ef=True
	ec="操作系统是win2012/2016才能设置超过4个CPU!"
end if
end If

End If'不是代理产品时再执行isagentpd=False



if not ef then

dim starttime,temptime,pdtype
pdtype=dshost("VPStype")
starttime=NOW
'结束时间
y=Request ("year")
if y=1 then temptime=dateadd("yyyy",1,now)
if y=dshost("PAY_2year") then temptime=dateadd("yyyy",2,now)
if y=dshost("PAY_3year") then temptime=dateadd("yyyy",3,now)
if y=dshost("PAY_4year") then temptime=dateadd("yyyy",4,now)
if y=dshost("PAY_5year") then temptime=dateadd("yyyy",5,now)
if y=dshost("PAY_DAY") then temptime=dateadd("s",86400,now)
if y=dshost("PAY_WEEK") then temptime=dateadd("n",10080,now)
if y=dshost("PAY_Month") then temptime=dateadd("y",31,now)
If Application("monthnot31")=True Then if y=dshost("PAY_Month") then temptime=dateadd("m",1,now)
if y=dshost("PAY_Season") then temptime=dateadd("y",92,now)
if y=dshost("PAY_halfyear") then temptime=dateadd("y",182,now)
if y=999 then
temptime=dateadd("y",Application("testtime"),now)
If Application("VPStestHour")>0 Then temptime=dateadd("n",Application("VPStestHour")*60,now)
dim isfortest
isfortest=true
end if
end If

if not ef then
if dshost("cancloud")=true then'是弹性购买产品'计算增量部分的普通用户情况下的金额

	'PAY_1yearvar=dsHost("usermoney")
	
'默认最小值addcpuMIN
'当前值addcpuNow
'增量每步addcpuNum
'每步需要钱数addCpuCost
if CInt(Request("CpuValue"))>dsHost("addCpuLim") Then
	ef=True
	ec="CPU超出上限!"
End If
if CInt(Request("RamValue"))>dsHost("addRamLim") Then
	ef=True
	ec="内存超出上限!"
End If
if CInt(Request("VHDValue"))>dsHost("addVHDLim") Then
	ef=True
	ec="虚拟硬盘超出上限!"
End If
if CInt(Request("MbpsValue"))>dsHost("addMbpsLim") Then
	ef=True
	ec="带宽超出上限!"
End If
If dsHost("CDNMaxMb")>0 then
if CInt(Request("NGBValue"))>dsHost("addNGBLim") Then
	ef=True
	ec="流量超出上限!"
End If
End If
If dsHost("MaxIOPS")>0 then
if CInt(Request("IopsValue"))>dsHost("addIOPSLim") Then
	ef=True
	ec="IOPS超出上限!"
End If
End if
if CInt(Request("SNAValue"))>dsHost("addSnaLim") Then
	ef=True
	ec="快照超出上限!"
End If
if CInt(Request("BakValue"))>dsHost("addBakLim") Then
	ef=True
	ec="备份数量超出上限!"
End If
if CInt(Request("IPValue"))>dsHost("addIPLim") Then
	ef=True
	ec="IP数量超出上限!"
End If
if (CInt(Request("CpuValue"))<dsHost("OSLimbyCPU")) Or (CInt(Request("RamValue"))<dsHost("OSLimbyRam")) Then
If InStr(","&dsHost("OSlim"),","&Request("OSAllList")&",")>0 then
	ef=True
	ec="由于内存或CPU限制不能预装这个操作系统!"
End If
End If

Dim cloudAddmoney
cloudAddmoney=0
if (CInt(Request("CpuValue"))>dsHost("CpuNum")) then	cloudAddmoney=cloudAddmoney+((Request("CpuValue")-dsHost("CpuNum"))/dsHost("addCpuNum"))*dsHost("addCpuCost")
if (CInt(Request("RamValue"))>dsHost("MAXRAM")) then	cloudAddmoney=cloudAddmoney+((Request("RamValue")-dsHost("MAXRAM"))/dsHost("addRamNum"))*dsHost("addRamCost")
if (CInt(Request("VHDValue"))>dsHost("Maxspace")) then	cloudAddmoney=cloudAddmoney+((Request("VHDValue")-dsHost("Maxspace"))/dsHost("addVHDNum"))*dsHost("addVHDCost")
if (CInt(Request("MbpsValue"))>dsHost("Maxmbps8")) then	cloudAddmoney=cloudAddmoney+((Request("MbpsValue")-dsHost("Maxmbps8"))/dsHost("addMbpsNum"))*dsHost("addMbpsCost")
If dsHost("CDNMaxMb")>0 then'如果限制流量
if (CInt(Request("NGBValue"))>dsHost("CDNMaxMb")) then	cloudAddmoney=cloudAddmoney+((Request("NGBValue")-dsHost("CDNMaxMb")/1000)/dsHost("addNGBNum"))*dsHost("addNGBCost")
End If
If dsHost("MaxIOPS")>0 then'如果限制IOPS
if (CInt(Request("IopsValue"))>dsHost("MaxIOPS")) then	cloudAddmoney=cloudAddmoney+((Request("IopsValue")-dsHost("MaxIOPS"))/dsHost("addIOPSNum"))*dsHost("addIOPSCost")
End if
if (CInt(Request("SNAValue"))>dsHost("MaxSNA")) then	cloudAddmoney=cloudAddmoney+((Request("SNAValue")-dsHost("MaxSNA"))/dsHost("addSnaNum"))*dsHost("addSnaCost")
if (CInt(Request("BakValue"))>dsHost("MaxBak")) then	cloudAddmoney=cloudAddmoney+((Request("BakValue")-dsHost("MaxBak"))/dsHost("addBakNum"))*dsHost("addBakCost")
if (CInt(Request("IPValue"))>dsHost("MaxIP")) then	cloudAddmoney=cloudAddmoney+((Request("IPValue")-dsHost("MaxIP"))/dsHost("addIpNum"))*dsHost("addIPCost")

cloudAddmoney=Clng(FormatNumber(cloudAddmoney,0,-1,0,0))'四舍五入

end If
end if

if not ef then
dim ef,ec,Userpaymoney,forpaytype,olduser_money,moneych,newuser_money,oldagn_money,mymoneych,newagn_money,Useragentname,agent_UP,agent_thisgree_cost,agent_this_name,logfor,pubisagnSer,AgnRunasUser
Userpaymoney=dsHost("usermoney")
forpayyear=Request ("year")
set RsUserds=ds
Useragentname=ds("agent1")
forpaytype="云服务器产品"
forpayid=dshost("id")
logfor="API区开通(云服务器名"&trim(vpsname)&")"
pubisagnSer=isAgnHostSer
AgnRunasUser=session("AgnRunasUser")
DoPayMoney
end if

if not ef then
dim Subject,body'send mail
vpsname=lcase(trim(vpsname))
dsph.AddNew
dsph("username")=ds ("username")
dsph("ServerlistID")=dsserver("id")
dsph("VPStype")=dshost("VPStype")
dsph("starttime")=starttime
dsph("endtime")=temptime
dsph("Cpunum")=dshost("Cpunum")
dsph("MaxRAM")=dshost("MaxRAM")
dsph("StartRam")=dshost("StartRam")
dsph("Maxmbps8")=dshost("Maxmbps8")
dsph("Minmbps8")=dshost("Minmbps8")
dsph("MaxCPU")=dshost("MaxCPU")
dsph("MaxSpace")=dshost("MaxSpace")
dsph("allowdomain")=dshost("allowdomain")
dsph("CDNMaxMb")=dshost("CDNMaxMb")
dsph("vpsname")=vpsname
dsph("VPSpassword")=VPSpassword
dsph("vhdpath")=replace(dsserver("homedir")&"\"&dsph("vpsname")&"."&dsserver("vhdtype"),"\\","\")
If Not isnull(dsserver("homedir2")) Then dsph("vhdpath2")=replace(dsserver("homedir2")&"\"&dsph("vpsname")&"."&dsserver("vhdtype"),"\\","\")
dsph("canbackupvhd")=dshost("canbackupvhd")
dsph("MaxIOPS")=dshost("MaxIOPS")
dsph("MaxIOPS2")=dshost("MaxIOPS2")
dsph("MaxIP")=dshost("MaxIP")
dsph("VLANid")=dshost("VLANid")
NetCardlimtype=dshost("NetCardlimtype")
'Response.write "test"
'Response.end

if dshost("cancloud")=true then'是弹性购买产品
dsph("Cpunum")=Request("CpuValue")
dsph("MaxRAM")=Request("RamValue")
dsph("MaxSpace")=Request("VHDValue")
dsph("Maxmbps8")=Request("MbpsValue")
dsph("MaxSNA")=Request("SNAValue")
dsph("MaxBak")=Request("BakValue")
dsph("MaxIP")=Request("IPValue")
If dsHost("MaxIOPS")>0 And Request("IopsValue")>0 Then dsph("MaxIOPS2")=Request("IopsValue")'只限制第二硬盘速度'就算用户选不限制产品默认值更优先
If dsHost("CDNMaxMb")>0 Then dsph("CDNMaxMb")=Request("NGBValue")*1000
dsph("FirstOSid")=Request("OSAllList")
end if

dsph("status")="准备开通"
if y=999 then
dsph("istest")="y"
else
dsph("istest")="n"
end if

if ds("agent1")<>"n" then
dsph("agent1")=ds("agent1")
else
dsph("agent1")="n"
end if


dsph("caninstallos")=dshost("caninstallos")
dsph("canbackupvhd")=dshost("canbackupvhd")

dsph("kefu")=ds("kefunow")

If RegExpTest("[^A-Za-z0-9]",Request("attach")) Then
isname=False
Else
dsph("Agnattach")=Request("attach")
End If

dsph("canGPU")=dshost("canGPU")
dsph("MAXRAMGPU")=dshost("MAXRAMGPU")
dsph("MaxHW")=dshost("MaxHW")

dsph.Update


'LOG
Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_VPS where vpsname='"&vpsname&"'"
	dsph.Open Sql,conn,1,3
pdid=dsph("id")
Sql="UPDATE [FreeHost].[FreeHost_Moneylog] set pdid='"&dsph("id")&"' where pdid='"&session("moneylog_pdid")&"'"
    conn.Execute Sql

if Not dshost("isagentpd")=true Then 
'if dshost("canADSL")=True Then conn.Execute "UPDATE FreeHost.FreeHost_Product_VPS_ADSL SET  VPSID='"&dsph("id")&"' WHERE ID in (SELECT TOP (1) Id FROM FreeHost.FreeHost_Product_VPS_ADSL WHERE VPSID=0 ORDER BY orderbyid DESC);"
if dshost("canADSL")=True then
Set dsVPSADSL = Server.CreateObject("ADODB.Recordset")	
		Sql="Select top 1 * from FreeHost.FreeHost_Product_VPS_ADSL where  errorADSLCode is null and ServerlistID="&dsserver("id")&" and VPSID=0 order by orderbyid desc"
		dsVPSADSL.Open Sql,conn,1,3
if Not dsVPSADSL.Eof then
dsVPSADSL("VPSID")=dsph("id")
If dsVPSADSL("VLANid")>0 Then dsph("VLANid")=dsVPSADSL("VLANid")
adslinfo="宽带帐号:"&dsVPSADSL("ADSLName")&"宽带密码:"&dsVPSADSL("ADSLpass")
dsVPSADSL.update
dsVPSADSL.close
End If
End If

Set dsVPSip = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Product_VPS_IP where ServerlistID="&dsserver("id")&" and VPSID=0  and ipbyid=0 order by orderbyid desc"
If IsUse_IP_AREA=True Then Sql="Select * from FreeHost.FreeHost_Product_VPS_IP where IP_AREA="&dsserver("IP_AREA")&" and VPSID=0 and ipbyid=0 order by orderbyid desc"'2018 IP池
		dsVPSip.Open Sql,conn,1,3
IP2="0"
IP2mask=0
IP2gateway=0
IP2dns1=0
IP2dns2=0
ipcount=0
MAC=dsVPSip("MAC")
If Not IsNull(dsVPSip("VLANid")) Then dsph("VLANid")=dsVPSip("VLANid")
havenextIP=false
Set dsVPSip2 = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Product_VPS_IP where ipbyid='"&dsVPSip("ID")&"' and VPSID=0 order by orderbyid desc"
		dsVPSip2.Open Sql,conn,1,3
If Not dsVPSip2.Eof Then
'有附属IP时
ip=dsVPSip("ip")
IPmask=dsVPSip("IPmask")
IPgateway=dsVPSip("IPgateway")
IPdns1=dsVPSip("IPdns1")
IPdns2=dsVPSip("IPdns2")
dsVPSip("VPSID")=dsph("id")
dsVPSip.update

IP2=dsVPSip2("IP")
IP2mask=dsVPSip2("IPmask")
IP2gateway=dsVPSip2("IPgateway")
IP2dns1=dsVPSip2("IPdns1")
IP2dns2=dsVPSip2("IPdns2")
dsVPSip2("VPSID")=dsph("id")
If IsUse_IP_AREA=True Then dsVPSip2("ServerlistID")=dsserver("id")'启用IP池的原因IP发生了转移,到了新服务器名下
dsVPSip2.update
dsVPSip2.close
havenextIP=true
end if

'dsVPSip.movefirst
If havenextIP=false then
While Not dsVPSip.Eof
If ipcount<dsph("MaxIP") then'如果选中2014
dsVPSip("VPSID")=dsph("id")
If IsUse_IP_AREA=True Then dsVPSip("ServerlistID")=dsserver("id")'启用IP池的原因IP发生了转移,到了新服务器名下
ipcount=ipcount+1
If IP2="0" And ip<>"" then
IP2=dsVPSip("IP")
IP2mask=dsVPSip("IPmask")
IP2gateway=dsVPSip("IPgateway")
IP2dns1=dsVPSip("IPdns1")
IP2dns2=dsVPSip("IPdns2")
End if
If IP="" then
IP=dsVPSip("IP")
IPmask=dsVPSip("IPmask")
IPgateway=dsVPSip("IPgateway")
IPdns1=dsVPSip("IPdns1")
IPdns2=dsVPSip("IPdns2")
End if
dsVPSip.update
End If
dsVPSip.movenext
Wend
dsVPSip.movefirst
End If

End if


'调用开通function
If Not isagentpd then'不是代理产品时再执行

URL=dsserver("site")
FreeHostsharekey=dsserver("FreeHostsharekey")
username=dsph ("vpsname")
username=dsph ("username")
homedir=dsserver("homedir")
starttime=dsph("starttime")
endtime=dsph("endtime")
type1=dsph("VPStype")


MAXcpu=dsph("MAXCPU")
CpuNum=dsph("CpuNum")
MAXRam=dsph("MAXRam")
StartRam=dsph("StartRam")
Maxmbps8=dsph("Maxmbps8")
Minmbps8=dsph("Minmbps8")

MAXspace=dsph("MAXspace")
vhdpath=dsph("vhdpath")
vhdpath2=dsph("vhdpath2")
If Not isnull(vhdpath) And isnull(vhdpath2) Then vhdpath2=Replace(vhdpath,".vhd","-2.vhd")

MaxIOPS=dsph("MaxIOPS")
MaxIOPS2=dsph("MaxIOPS2")
VLANid=dsph("VLANid")

canGPU=dsph("canGPU")
MAXRAMGPU=dsph("MAXRAMGPU")
MaxHW=dsph("MaxHW")
If MAC="000000000000" Then MAC=null
'IP=dsph("ip")'分配的IP

'if y=999 and Application("testsame")<>true then'如果是试用
'MaxConnections=Application("MaxConnections")
'spacelimit=Application("spacelimit")
'MaxBandwidth=Application("MaxBandwidth")
'end if


If Application("smsVPSopen")=True And (ds("agent1")="n" Or Application("agncangetsms")=True) Then
Dim username
username=ds("username")
mobi=Trim(ds("mobi"))
smsContent=Application("smsVPSopencon")
'恭喜!您的邮箱产品已开通了!用户名 :#用户名#产品类型 :#产品类型#到期时间是 :#到期时间#您的帐户余款是 :#金额# 元
smsContent=Replace(smsContent,"#用户名#",ds("username"))
smsContent=Replace(smsContent,"#产品类型#",dsph("VPStype"))
smsContent=Replace(smsContent,"#到期时间#",formatdatetime(dsph("endtime"),1))
smsContent=Replace(smsContent,"#金额#",newuser_money)
If Application("smsByint")=2 Then'阿里云处理
'开通${product}成功,产品帐号${proname},密码${propass},到期${endtime},余款${usermoney}元,备注${info}
smsContent="{""product"":""云服务器"",""proname"":"""&vpsname&""",""propass"":"""&VPSpassword&""",""endtime"":"""&formatdatetime(dsph("endtime"),1)&""",""usermoney"":"""&newuser_money&""",""info"":"":用户名"&Replace(ds("username"),"qq","QQ")&"""}"
End if
ret=SendSms(mobi,smsContent,0,Now,Application("smsvpsopen_code"))
End if

'dim Subject,body
emailVPSopen
ret=Send2Mail(conn,ds("username"),Subject,body)

'dsph.close


Application.lock
Application("hostoptime")=now
Application("hostoplock")=true
Application.unlock
varcon="makevps "&username&" "&vpsname&" "&CpuNum&" "&MAXcpu&" "&MAXRam&" "&MAXspace&" "&vhdpath&" "&StartRam
If dsserver("OStype")="Windows Server 2012" Then varcon=varcon&" 0 "&Maxmbps8*1024*1024
If dsserver("OStype")="Windows Server 2012R2" Or dsserver("OStype")="Windows Server 2016" Then varcon=varcon&" 0 "&Maxmbps8*1024*1024&" "&dsserver("SwitchName")&" "&StartRam&" "&vhdpath2&" 10 "&(MAXspace-10)&" defaultClusterNameby7i24 "&MaxIOPS&" "&MaxIOPS2&" NULLswitchname "&VLANid&" "&NetCardlimtype
If dsserver("IsCluster")=true Then varcon=Replace(varcon,"defaultClusterNameby7i24",dsserver("ClusterName"))
If Not isnull(dsserver("SwitchName2")) Then varcon=Replace(varcon,"NULLswitchname",dsserver("SwitchName2"))
If canGPU Then varcon=varcon&" GPUsetInfo-"&MAXRAMGPU*1024*1024&"-"&MaxHW
If Not IsNull(MAC) Then varcon=varcon&" SETMAC-"&MAC

temp=VPSOP(URL,FreeHostsharekey,varcon,0)

If Not isnull(dsserver("SwitchName2")) Then '处理switch
If InStr(temp,vbcrlf&vbcrlf&vbcrlf&"SwitchName : ") Then
arysw=Split(temp,vbcrlf&vbcrlf&vbcrlf&"SwitchName : ")
arysw2=Split(arysw(1),vbcrlf&vbcrlf&vbcrlf)
arysw3=Split(arysw2(0),vbcrlf)
If dsserver("SwitchName")=arysw3(0) Then
dsph("MAC")=replace(arysw3(1),"MacAddress : ","")
dsph("MAC2")=replace(arysw3(4),"MacAddress : ","")
Else
dsph("MAC")=replace(arysw3(4),"MacAddress : ","")
dsph("MAC2")=replace(arysw3(1),"MacAddress : ","")
End If
End if
End if'完成switch

dsph.update

Application.lock
Application("hostoplock")=false
Application.unlock

Sql="update FreeHost.FreeHost_Product_VPS set status='等待安装操作系统' where vpsname='"&vpsname&"'"
    conn.Execute Sql

adslinfo=""
if not isnull(dsph("ADSLName")) then
ADSLNameinfo="宽带账户"&dsph("ADSLName")&"宽带密码"&dsph("ADSLpass")
adslinfo="宽带帐号:"&dsph("ADSLName")&"宽带密码:"&dsph("ADSLpass")
ADSLName=dsph("ADSLName")
ADSLpass=dsph("ADSLpass")
else
Set dsADSL = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_Product_VPS_ADSL where VPSID="&dsph("id")
dsADSL.Open Sql,conn,1,1
while not dsADSL.eof
ADSLNameinfo="宽带账户"&dsADSL("ADSLName")&"宽带密码"&dsADSL("ADSLpass")
adslinfo="宽带帐号:"&dsADSL("ADSLName")&"宽带密码:"&dsADSL("ADSLpass")
ADSLName=dsADSL("ADSLName")
ADSLpass=dsADSL("ADSLpass")
dsADSL.movenext
wend
end if

Set dsVPSip = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Product_VPS_IP where VPSID="&dsph("id")&" order by SwitchName asc"
		dsVPSip.Open Sql,conn,1,1
	'	If Not isnull(dsPORTserver("cname")) Then
     '       vpsip=dsPORTserver("cname") & ":" & portstart
      '  Else
       '     vpsip=dsPORTserver("IP") & ":" & portstart
       ' End if
IParycon=""'前面是IP,后面是MAC,网卡代号,虚拟交换机名
while not dsVPSip.eof
If isONEip Then
EndIP=IPopen
portstart=dsVPSip("portstart")+4
portend=dsVPSip("portstart")+dsPORTserver("portperip")-1
End If
SwitchName=dsserver("SwitchName")
MAC=dsph("MAC")
If dsVPSip("SwitchName")=2 Then SwitchName=dsserver("SwitchName2")
If dsVPSip("SwitchName")=2 Then MAC=dsph("MAC2")
If isnull(MAC) Then MAC="NULL"
IParycon=IParycon&""&dsVPSip("IP")&"$"&dsVPSip("IPmask")&"$"&dsVPSip("IPgateway")&"$"&dsVPSip("IPdns1")&"$"&dsVPSip("IPdns2")&"$"&MAC&"$"&SwitchName&"#"
dsVPSip.movenext
Wend

FreeHost_oplog session("username"),"信息","API区,用户开通云服务器产品:("&vpsname&") "&temp&",用户:"&dsph("username")&",分配IP端口MAC信息:"&vpsip&IParycon&",分配ADSL拨号信息:"&adslinfo
'FreeHost_oplog session("username"),"信息","API区,用户开通云服务器产品:("&vpsname&") "&temp

'If Not isagentpd then'不是代理产品时再执行
'Response.Write "下面应用硬防的预装策略:<br>"
Set dsACLTmp = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_Product_VPS_ACLTemplate where ServerlistID='"&dsserver("id")&"' order by Weight desc"
		dsACLTmp.Open Sql,conn,1,1
If dsACLTmp.Eof Then
noACl=true
else
while not dsACLTmp.Eof
varcon="VMAddACLUsing -Action "&dsACLTmp ("Action")&" -Direction "&dsACLTmp ("Direction")&" -Protocol "&dsACLTmp ("Protocol")&" -Weight "&dsACLTmp ("Weight")
If dsACLTmp ("ParentAdapter")<>"" and dsACLTmp ("ParentAdapter")<>"ANY" Then varcon=varcon&" -VMNetworkAdapterName "&dsACLTmp ("ParentAdapter")
If dsACLTmp ("RemoteIPAddress")<>"" Then varcon=varcon&" -RemoteIPAddress "&dsACLTmp ("RemoteIPAddress")
If dsACLTmp ("RemotePort")<>"" Then varcon=varcon&" -RemotePort "&dsACLTmp ("RemotePort")
If dsACLTmp ("LocalIPAddress")<>"" Then varcon=varcon&" -LocalIPAddress "&dsACLTmp ("LocalIPAddress")
If dsACLTmp ("LocalPort")<>"" Then varcon=varcon&" -LocalPort "&dsACLTmp ("LocalPort")
varcon=varcon&" -VMName "&vpsname
'Response.write varcon
'Response.end
temp=ACLOP(URL,FreeHostsharekey,varcon,0)
'Response.write "策略优先级:"&dsACLTmp ("Weight")&"执行结果:"&temp&"<br>"
FreeHost_oplog session("agentusername"),"信息","代理开通云服务器产品: ("&vpsname&") 设置硬防策略返回:"&temp
If InStr(temp,"L命令成功执行。")>1 Then'复制这个策略到单个VPS策略表中
	Set dsACL = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_Product_VPS_ACL where ServerlistID='"&dsserver("id")&"' order by Weight desc"
		dsACL.Open Sql,conn,3,2
dsACL.addnew
dsACL("ACLmyname")="预装时生成默认策略"
dsACL("opusername")=session("username")
'dsACL("admusername")=dsACLTmp("admusername")
dsACL("starttime")=NOW
dsACL("ServerlistID")=dsACLTmp ("id")
dsACL("Action")=dsACLTmp("Action")
dsACL("Direction")=dsACLTmp("Direction")
dsACL("Protocol")=dsACLTmp("Protocol")
dsACL("Weight")=dsACLTmp("Weight")
dsACL("ParentAdapter")=dsACLTmp("ParentAdapter")
dsACL("RemoteIPAddress")=dsACLTmp("RemoteIPAddress")
dsACL("RemotePort")=dsACLTmp("RemotePort")
dsACL("LocalIPAddress")=dsACLTmp("LocalIPAddress")
dsACL("LocalPort")=dsACLTmp("LocalPort")
dsACL("userCanDel")=dsACLTmp("userCanDel")
dsACL("username")=dsph("username")
dsACL("vpsname")=dsph("vpsname")
dsACL.update
dsACL.close
End if
'Response.end
dsACLTmp.movenext
wend
End If
'End if

'If Not isagentpd then'不是代理产品时再执行
'Response.Write "下面应用防ARP攻击/限制用户盗用IP策略:<br>"
If dsserver("ANIArp")=true Then
'得到IP列表,发给受控
Set dsVPSip = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Product_VPS_IP where VPSID="&dsph("id")&" order by SwitchName asc"
		dsVPSip.Open Sql,conn,1,1
IParycon=""'前面是IP,后面是MAC,网卡代号,虚拟交换机名
while not dsVPSip.eof
IParycon=IParycon&""&dsVPSip("IP")&"#"
dsVPSip.movenext
Wend
dsVPSip.close
'Response.Write "当前已分配的IP为:"&IParycon&"<br>"
varcon="VMARPACLUsing  -VMName "&vpsname&" -LocalIPAddress "&IParycon&" -MAC NONE"
'Response.write varcon&"<br>"
'Response.end
temp=ACLOP(URL,FreeHostsharekey,varcon,0)
'Response.write "执行结果:"&temp&"<br>"
FreeHost_oplog session("username"),"信息","用户开通云服务器产品: ("&vpsname&") 设置防ARP策略返回:"&temp
Else
'Response.Write "本服务器没启用此功能.<br>"
End If
'End if

OSAllList=Request("OSAllList")
if OSAllList<>"" and IsNumeric(OSAllList) then
oridir=dsserver("osfile"&OSAllList)
if len(oridir)>3 Then
todir=dsph("vhdpath")
EndIP=IP
VPSpassword=dsph("VPSpassword")
portstart=0
portend=0
Set dsVPSip = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Product_VPS_IP where VPSID="&dsph("id")&" order by SwitchName asc"
		dsVPSip.Open Sql,conn,1,1
IParycon=""'前面是IP,后面是MAC,网卡代号,虚拟交换机名
while not dsVPSip.eof
If isONEip Then
EndIP=IPopen
portstart=dsVPSip("portstart")+4
portend=dsVPSip("portstart")+dsPORTserver("portperip")-1
else'不是共享IP'2019-12-1
If Application("CanRanPort")=True Then'启用了端口随机化
Randomize
portstart=int(rnd*(32767-10000+1))+10000
dsph("Pubport")=portstart
End If'完成端口随机化
End If
SwitchName=dsserver("SwitchName")
MAC=dsph("MAC")
If dsVPSip("SwitchName")=2 Then SwitchName=dsserver("SwitchName2")
If dsVPSip("SwitchName")=2 Then MAC=dsph("MAC2")
If isnull(MAC) Then MAC="NULL"
IParycon=IParycon&""&dsVPSip("IP")&"$"&dsVPSip("IPmask")&"$"&dsVPSip("IPgateway")&"$"&dsVPSip("IPdns1")&"$"&dsVPSip("IPdns2")&"$"&MAC&"$"&SwitchName&"#"
dsVPSip.movenext
Wend
dsVPSip.close
varcon="installos "&username&" "&vpsname&" "&oridir&" "&todir&" "&IP&" "&IPmask&" "&IPgateway&" "&IPdns1&" "&IPdns2&" 1 "&MAXspace&" "&VPSpassword&" "&portstart&" "&portend&" "&IP2&" "&IP2mask&" "&IP2gateway&" "&IP2dns1&" "&IP2dns2&" NotCluster NOADSL- 0 0 []"&iparycon
If dsserver("IsCluster")=true Then varcon=Replace(varcon,"NotCluster","isCluster")

if not isnull(dsph("ADSLName")) Then
ADSLtxtInfo=dsph("ADSLName")&"/"&dsph("ADSLpass")
else
	Set dsADSL = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Product_VPS_ADSL where VPSID="&dsph("id")
		dsADSL.Open Sql,conn,1,1
while not dsADSL.eof
ADSLtxtInfo=dsADSL("ADSLName")&"/"&dsADSL("ADSLpass")&" "&ADSLtxtInfo
dsADSL.movenext
Wend
ADSLtxtInfo=RTrim(ADSLtxtInfo)
end If
If ADSLtxtInfo<>"" Then varcon=Replace(varcon,"NOADSL-","HAVEADSL-"&ADSLtxtInfo)

temp=VPSOP(URL,FreeHostsharekey,varcon,1)'0=now
'Response.Write varconA
'Response.Write "装入网站"&dsserver("osname1")&"操作结果:"
Sql="update FreeHost.FreeHost_Product_VPS set status='正常' where vpsname='"&vpsname&"'"
    conn.Execute Sql
'Response.Write temp
FreeHost_oplog session("username"),"信息","用户预装云服务器产品操作系统: "&temp
End If
end if

Else '进入上级处理




dsph("isagentpd")=dshost("isagentpd")
dsph("VPSComName")=dshost("VPSComName")
dsph("VPSApiName")=dshost("VPSApiName")
dsph("VPScpdomain")=dshost("VPScpdomain")
dsph("Agnuserid")=dshost("Agnuserid")
dsph("Domain_Agent_nonemd5_6")=dshost("Domain_Agent_nonemd5_6")
dsph("Agnidc")=dshost("Agnidc")
dsph("Agnproductid")=dshost("Agnproductid")
dsph.update

VPSApiName=dsph("VPSApiName")
userid=dsph("Agnuserid")
userstr=md5(dsph("Domain_Agent_nonemd5_6")&"7i24.com")
yearAgn=Request ("year")
idc=dsph("Agnidc")
productid=dsph("Agnproductid")
attach=ds("username")

tar="http://"&VPSApiName&"/api/cloudapi.asp?userid="&userid&"&userstr="&userstr&"&year="&yearAgn&"&vpsname="&vpsname&"&VPSpassword="&dsph ("VPSpassword")&"&idc="&idc&"&productid="&productid&"&action=activate&attach="&attach&"&CpuValue="&Request("CpuValue")&"&RamValue="&Request("RamValue")&"&VHDValue="&Request("VHDValue")&"&MbpsValue="&Request("MbpsValue")&"&NGBValue="&Request("NGBValue")&"&IopsValue="&Request("IopsValue")&"&SNAValue="&Request("SNAValue")&"&BakValue="&Request("BakValue")&"&IPValue="&Request("IPValue")&"&OSAllList="&Request("OSAllList")&"&installos="&Request("installos")
'Response.write tar


if dsph("VPSComName")="pptp" then
tar="http://"&dsph("VPSApiName")&"/index/api/useradd.html?token="&dsph("Domain_Agent_nonemd5_6")&"&username="&dsph ("vpsname")&"&password="&dsph ("VPSpassword")&"&exp="&DateDiff("s", "01/01/1970 00:00:00", dsph("endtime"))
temp=ONLY_GET(tar,"")
FreeHost_oplog session("username"),"信息","用户区,用户开通云服务器PPTP产品(代理上级):("&vpsname&") "&temp

If InStr(temp,"status=ok&info=uid:") then
pptpuid=split(temp,"status=ok&info=uid:")(1)
Sql="update FreeHost.FreeHost_Product_VPS set status='正常',pptpuid='"&pptpuid&"' where vpsname='"&vpsname&"'"
    conn.Execute Sql
Else
Sql="update FreeHost.FreeHost_Product_VPS set status='失败' where vpsname='"&vpsname&"'"
    conn.Execute Sql
response.write "e=调用上级API时出错,开通失败,但费用已扣,请联系管理员手工处理!出错原因为:"&server.urlencode(temp)
End If

else

temp=ONLY_GET(tar,"")

FreeHost_oplog session("username"),"信息","用户区,用户开通云服务器产品(代理上级):("&vpsname&") "&temp

If InStr(temp,"ret=ok") then
Sql="update FreeHost.FreeHost_Product_VPS set status='正常' where vpsname='"&vpsname&"'"
    conn.Execute Sql
Else
Sql="update FreeHost.FreeHost_Product_VPS set status='失败' where vpsname='"&vpsname&"'"
    conn.Execute Sql
response.write "e=调用上级API时出错,开通失败,但费用已扣,请联系管理员手工处理!出错原因为:"&server.urlencode(temp)
End If

end if




End if'上级是代理,我是中间代理

'conn.close
'Set conn=Nothing

'response.write "ret=ok&vpsname="&vpsname&"&vpspassword="&VPSpassword&"&endtime="&year(endtime)&"-"&month(endtime)&"-"&day(endtime)&" "&hour(endtime)&":"&minute(endtime)&":"&second(endtime)&"&cpurl="&Application("VPScpdomain_Agn")&"&attach="&request("attach")
response.write "ret=ok&vpsname="&vpsname&"&vpspassword="&VPSpassword&"&endtime="&year(endtime)&"-"&month(endtime)&"-"&day(endtime)&"&cpurl="&Application("VPScpdomain_Agn")&"&ADSLNameinfo="&ADSLnameinfo&"&ADSLName="&ADSLname&"&adSLpass="&ADSLpass&"&attach="&request("attach")
End if'正常开通



End if'开通操作.
End If


Function ACLOP(URL,FreeHostsharekey,vpscon,op)
  Dim returnstr,body
body=URLEncoding("vpscon="&vpscon&"&op="&op)
Set MaintoCSCom=Server.CreateObject("www.7i24.com")
returnstr=MaintoCSCom.DOHTTPSSLX(Url&"?",FreeHostsharekey,body,FreeHost_t1,FreeHost_t2,FreeHost_t3,FreeHost_t4)
If MaintoCSCom.IsError Then
Response.write "出错:error:状态码:"&MaintoCSCom.Do7i24Status
'Response.write "出错:error:详细返回:"&MaintoCSCom.FunGetErrorInfo()
End if
Set MaintoCSCom =Nothing
  ACLOP = returnstr
End Function

%>

提示的错误:


Microsoft VBScript 运行时错误 错误 '800a01a8'


缺少对象: 'dsph'    


行 663


错误的位置 是 dsph.AddNew 也就是下面的第4行 麻烦有大佬帮忙看看是哪里错了吗,我实在是绞尽脑汁了:

if not ef then
dim Subject,body'send mail
vpsname=lcase(trim(vpsname))
dsph.AddNew
dsph("username")=ds ("username")
dsph("ServerlistID")=dsserver("id")
dsph("VPStype")=dshost("VPStype")
dsph("starttime")=starttime
dsph("endtime")=temptime
dsph("Cpunum")=dshost("Cpunum")
dsph("MaxRAM")=dshost("MaxRAM")
dsph("StartRam")=dshost("StartRam")
dsph("Maxmbps8")=dshost("Maxmbps8")
dsph("Minmbps8")=dshost("Minmbps8")
dsph("MaxCPU")=dshost("MaxCPU")
dsph("MaxSpace")=dshost("MaxSpace")
dsph("allowdomain")=dshost("allowdomain")
dsph("CDNMaxMb")=dshost("CDNMaxMb")
dsph("vpsname")=vpsname
dsph("VPSpassword")=VPSpassword
dsph("vhdpath")=replace(dsserver("homedir")&"\"&dsph("vpsname")&"."&dsserver("vhdtype"),"\\","\")
If Not isnull(dsserver("homedir2")) Then dsph("vhdpath2")=replace(dsserver("homedir2")&"\"&dsph("vpsname")&"."&dsserver("vhdtype"),"\\","\")
dsph("canbackupvhd")=dshost("canbackupvhd")
dsph("MaxIOPS")=dshost("MaxIOPS")
dsph("MaxIOPS2")=dshost("MaxIOPS2")
dsph("MaxIP")=dshost("MaxIP")
dsph("VLANid")=dshost("VLANid")
NetCardlimtype=dshost("NetCardlimtype")
'Response.write "test"
'Response.end


105
0
1
发表评论
评论 0 排序方式
查看更多
已有0次打赏
(1) 分享
分享

请保存二维码或复制链接进行分享

取消