<%@ 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=万网主机产品&id="&Request.QueryString ("id")
	ef=True
	ec="请您先登陆会员区。"
ElseIf Request.QueryString ("id")="" Then
	ef=True
	ec="请选择产品！"
ElseIf Not Application("usenetcnhost")=true 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 dsNetCNpdlist = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_NetCNProductlist where id='"&Request.QueryString ("id")&"'"
	if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
	dsNetCNpdlist.Open Sql,conn,1,1
if dsNetCNpdlist.Eof then
	ef=True
	ec="产品不存在！"
Else
'读取月付
PAY_Month=dsNetCNpdlist("PAY_Month")
PAY_Season=dsNetCNpdlist("PAY_Season")
PAY_halfyear=dsNetCNpdlist("PAY_halfyear")
PAY_Nextyear=dsNetCNpdlist("PAY_Nextyear")
PAY_2year=dsNetCNpdlist("PAY_2year")
PAY_3year=dsNetCNpdlist("PAY_3year")
PAY_4year=dsNetCNpdlist("PAY_4year")
PAY_5year=dsNetCNpdlist("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="selfNetCN2.asp" method="post" name="autoopen">
  <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">开通万网主机产品：</font></TD>
        <TD height="40" colspan="2" bgColor=#ffffff><%
	info=dsNetCNpdlist("info")
	NetCNtype=dsNetCNpdlist("Hosttype")
	remindinfo=dsNetCNpdlist("remindinfo")
	productid=dsNetCNpdlist("productid")
if agentname<>"n" then 
	Set newname_NetCN = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_NetCNProductlist_AGN where agent1='"&agentname&"' and id='"&dsNetCNpdlist("id")&"'"
		newname_NetCN.Open Sql,conn,1,1
if not newname_NetCN.eof then
info=newname_NetCN("info")
NetCNtype=newname_NetCN("NetCNtype")
remindinfo=newname_NetCN("remindinfo")
newname_NetCN.close
end if
end if
%>　<a href="/style/info/hostNetCNmore.asp?id=<%=Request.QueryString ("id")%>" target="_blank"><strong><font size="3"><%=NetCNtype%></font></strong></a></TD>
      </TR>
      <TR>
        <TD width="17%" rowspan="8" vAlign=middle bgColor=#EEEEEE>&nbsp;</TD>
      </TR>
      <TR>
        <TD width="13%" height="60" bgColor=#ffffff>　开通说明：</TD>
        <TD width="70%" height="60" bgColor=#ffffff><%=remindinfo%>　</TD>
      </TR>
      <TR>
        <TD height="50" bgColor=#ffffff>　域名：</TD>
        <TD height="50" bgColor=#ffffff><input name="domain" type="text" size="30" value=""></TD>
      </TR>
      <TR>
        <TD height="50" bgColor=#ffffff>　请选择机房：</TD>
        <TD height="50" bgColor=#ffffff><input name="idc" type="radio" value="qdabtn" checked>
青岛机房</TD>
      </TR>
      <TR>
        <TD height="50" bgColor=#ffffff><font color="#000000">　操作系统：</font></TD>
        <TD height="50" bgColor=#ffffff>
          <input name="os" type="radio" value="nt" checked>
Windows
<input name="os" type="radio" value="unix">
Unix</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 dsNetCNpdlist("canmonth")="y" then%>
          <option value="<%=PAY_Month%>">一个月</option>
          <%end if%>
          <%if dsNetCNpdlist("canseason")="y" then%>
          <option value="<%=PAY_Season%>">三个月</option>
          <%end if%>
          <%if dsNetCNpdlist("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=dsNetCNpdlist("usermoney")
if agentname<>"n" then
	Set dsendmoney = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_user_price where prtype='万网主机产品' and username='"&agentname&"' and id="&dsNetCNpdlist("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='万网主机产品' and username='"&agentname&"' and id="&dsNetCNpdlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
usermoney=dsNetCNpdlist("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="7" readonly="true" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" ></TD>
      </TR>
      <TR>
        <TD height="50" colspan="2" bgColor=#ffffff>　
          <input name="openX" type="submit" value="马上开通" onClick="document.autoopen.openX.value ='请等待不要重复刷新！....';document.autoopen.openX.disabled=true;document.autoopen.submit()">
<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%>)*100)/100+' 元';
	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%>
