<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
'If session("agentusername")<>"" Then Response.Redirect "/agent/admother2.asp?username="&session("agentusername")&"&id="&Request.QueryString ("id")

If session("username")="" And session("agentusername")="" Then
If Application("canuseorder")=true and Request.ServerVariables("HTTP_FreeHostAPI")<>"7i24.com" Then Response.Redirect "order.asp?type=IDC产品&id="&Request.QueryString ("id")
	ef=True
	ec="请您先登陆会员区。"
ElseIf Request.QueryString ("id")="" Then
	ef=True
	ec="请选择产品！"
ElseIf Instr(1, Request.QueryString ("id"), "'", 1)>0 then
	ef=True
	ec="非法产品ID！"
ElseIf not IsNumeric(Request.QueryString ("id"))  Then
	ef=True
	ec="产品ID应该是数字！"
end if
if not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")

agentname=session("agentname")
AgnRunasUser=session("AgnRunasUser")
If session("agentusername")<>"" Then
agentname=session("agentusername")
AgnRunasUser=True
End If

if AgnRunasUser=True then 
	Set dsagent = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent where username='"&agentname&"'"
		dsagent.Open Sql,conn,1,1
if Not dsagent.eof then
Set dsagnettype = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_Agent_pers where agenttype='"&dsagent("agenttype")&"'" 
		dsagnettype.Open Sql,conn,1,1
if Not dsagnettype.eof Then
canshowagnpric=True
Else
canshowagnpric=false
End if
end If
dsagent.close
end If

	Set dsIDCpdlist = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_IDCProductlist where id='"&Request.QueryString ("id")&"'"
	if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
	dsIDCpdlist.Open Sql,conn,1,1
if dsIDCpdlist.Eof then
	ef=True
	ec="产品不存在！"
Else
'读取月付
PAY_Month=dsIDCpdlist("PAY_Month")
PAY_Season=dsIDCpdlist("PAY_Season")
PAY_halfyear=dsIDCpdlist("PAY_halfyear")
PAY_Nextyear=dsIDCpdlist("PAY_Nextyear")
PAY_2year=dsIDCpdlist("PAY_2year")
PAY_3year=dsIDCpdlist("PAY_3year")
PAY_4year=dsIDCpdlist("PAY_4year")
PAY_5year=dsIDCpdlist("PAY_5year")
end If
end if
if not ef then
if session("agentusername")<>"" Then%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html5")%>
<%else%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html2")%>
<%End if%>
　 托管/租用类自助开通
<%if session("agentusername")<>"" Then%>
<%=htmlwrite("html6")%>
<%else%>
<%=htmlwrite("html3")%>
<%End if%>
<br>
<form action="selfIDC2.asp" method="post" name="form1">
  <TABLE 
            width="100%" border=1 align=center cellPadding=0 cellSpacing=0 borderColorLight=#cccccc borderColorDark=#fbfbfb>
    <TBODY>
      <TR>
        <TD width="17%" vAlign=middle bgColor=#9E9E9E>&nbsp; <font color="#FFFFFF">开通IDC产品：</font></TD>
        <TD height="40" colspan="2" bgColor=#ffffff><%
	info=dsIDCpdlist("info")
	IDCtype=dsIDCpdlist("IDCtype")
	remindinfo=dsIDCpdlist("remindinfo")
if agentname<>"n" then 
	Set newname_IDC = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_IDCProductlist_AGN where agent1='"&agentname&"' and id='"&dsIDCpdlist("id")&"'"
		newname_IDC.Open Sql,conn,1,1
if not newname_IDC.eof then
info=newname_IDC("info")
IDCtype=newname_IDC("IDCtype")
remindinfo=newname_IDC("remindinfo")
newname_IDC.close
end if
end if
%>　<a href="/style/info/IDCmore.asp?id=<%=Request.QueryString ("id")%>" target="_blank"><strong><font size="3"><%=IDCtype%></font></strong></a></TD>
      </TR>
      <TR>
        <TD width="17%" rowspan="7" vAlign=middle bgColor=#EEEEEE>&nbsp;</TD>
      </TR>
      <TR>
        <TD height="50" bgColor=#ffffff>　开通说明：</TD>
        <TD height="50" bgColor=#ffffff><%=remindinfo%></TD>
      </TR>
      <TR>
        <TD height="50" bgColor=#ffffff>　请选择机柜/机房：</TD>
        <TD height="50" bgColor=#ffffff><%
	Set dsX = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_IDCJG order by id asc"
		dsX.Open Sql,conn,1,1
If dsX.Eof Then%>
  列表为空.
    <%else%>
    <select name="ServerlistID" id="ServerlistID">
      <%while not dsX.Eof%>
      <%if dsIDCpdlist("ServerlistID")=dsX("id") or dsIDCpdlist("ServerlistID2")=dsX("id") or dsIDCpdlist("ServerlistID3")=dsX("id") or dsIDCpdlist("ServerlistID4")=dsX("id") or dsIDCpdlist("ServerlistID5")=dsX("id") then%>
      <option value="<%=dsX("id")%>" <%if dsX("id")=selectedserverid then%>selected<%end if%>><%=dsX("jgname")%>[<%=dsX("jfname")%>]</option>
      <%end if%>
      <%
dsX.movenext
wend%>
    </select>
    <%end if%>
        </TD>
      </TR>
      <TR>
        <TD height="50" bgColor=#ffffff><font color="#000000">　有效期限：</font></TD>
        <TD height="50" bgColor=#ffffff><select name="year"  onChange="chusrm(this.options[this.options.selectedIndex].value)">
<option value="0" selected>请您选择</option>
            <%if dsIDCpdlist("canmonth")="y" then%>
            <option value="<%=PAY_Month%>">一个月</option>
            <%end if%>
            <%if dsIDCpdlist("canseason")="y" then%>
            <option value="<%=PAY_Season%>">三个月</option>
            <%end if%>
            <%if dsIDCpdlist("canhalfyear")="y" then%>
            <option value="<%=PAY_halfyear%>">半年</option>
            <%end if%>
            <option value="1">一年</option>
<option value="<%=PAY_2year%>">两年</option>
<option value="<%=PAY_3year%>">三年</option>
<option value="<%=PAY_4year%>">四年</option>
<option value="<%=PAY_5year%>">五年</option>
          </select>
            
            <%
usermoney=dsIDCpdlist("usermoney")
if agentname<>"n" then
	Set dsendmoney = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_user_price where prtype='IDC产品' and username='"&agentname&"' and id="&dsIDCpdlist("id")&""
		dsendmoney.Open Sql,conn,1,1
if not dsendmoney.eof then
usermoney=dsendmoney("usermoney")
end if
dsendmoney.close
end If

if canshowagnpric then%>　　<font color=red>(代理成本价格
<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='IDC产品' and username='"&agentname&"' and id="&dsIDCpdlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
usermoney=dsIDCpdlist("price"&dsagnettype("id"))'得到产品定义中的此级别的代理价
'if isreplay then myrealcost=RsDlist("usermoneyagnrepay")'续费
else
usermoney=dsagnpri("usermoney")'如果手工定义过此代理的价格就提取此价格
'if isreplay then myrealcost=dsagnpri("usermoneyrepay")'续费
end if
dsagnpri.close
%>)</font><%End if%> 　
  <input name="moneynow" type="text" value="" size="9" readonly="true" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" ></TD>
      </TR>
      <TR>
        <TD height="103" bgColor=#ffffff>　请输入备注：</TD>
        <TD height="103" bgColor=#ffffff><textarea name="userremindinfo" cols="40" rows="5" id="userremindinfo"></textarea></TD>
      </TR>
      <TR>
        <TD height="50" colspan="2" bgColor=#ffffff>　
        <input name="Submit" type="submit" id="Submit" value="马上下订单">
<input type="hidden" name="id" value="<%=Request.QueryString ("id")%>">		
		</TD>
      </TR>
    </TBODY>
  </TABLE>
</form><script language="JavaScript" type="text/JavaScript">
//document.openX.moneynow.value=<%=usermoney%>;
function chusrm(s)
{
	document.all.moneynow.value=Math.round((s*<%=usermoney%>))+' 元';
	if (s==999)
	document.all.moneynow.value='0'+' 元';
}
</script>
<%if session("agentusername")<>"" Then%>
<%=htmlwrite("html7")%>
<%else%>
<%=htmlwrite("html4")%>
<%End if%>
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
