<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
If session("agentusername")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
ElseIf Request("username")=""  or RegExpTest("[^A-Za-z0-9]",Request("username")) Then
	ef=True
	ec="请输入用户名！"
ElseIf Request("id")="" Then
	ef=True
	ec="请选择产品！"
ElseIf not IsNumeric(Request("id"))  Then
	ef=True
	ec="ID应该是数字！"
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  (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"') and username='"&Request("username")&"'"
				if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		ds.Open Sql,conn,1,1
if ds.eof then
	ef=True
	ec="用户不存在!"
end if
end if

if not ef then
  Set dsagent = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_AGENT where username='"&ds("agent1")&"'"
		if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		dsagent.Open Sql,conn,1,3
If dsagent.Eof Then
		ef=True
		ec="代理会员名不存在或密码出错了！"
end if
end if

if not ef then
	Set dsphOther = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_OtherProductlist where id='"&Request("id")&"'"
			if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
	dsphOther.Open Sql,conn,1,1
if dsphOther.Eof then
	ef=True
	ec="产品不存在！"
Else

'读取月付
PAY_Month=dsphOther("PAY_Month")
PAY_Season=dsphOther("PAY_Season")
PAY_halfyear=dsphOther("PAY_halfyear")
PAY_Nextyear=dsphOther("PAY_Nextyear")
PAY_2year=dsphOther("PAY_2year")
PAY_3year=dsphOther("PAY_3year")
PAY_4year=dsphOther("PAY_4year")
PAY_5year=dsphOther("PAY_5year")

end if
end if

if not ef then
'	Othertype=dsphOther("Othertype")
	Set newname_Other = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_OtherProductlist_AGN where agent1='"&session("agentusername")&"' and id='"&dsphOther("id")&"'"
		newname_Other.Open Sql,conn,1,1
if not newname_Other.eof then
info=newname_Other("info")
Othertype=newname_Other("Othertype")
end if
newname_Other.close
end if


if not ef then
	Set dsagnettype = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_Agent_pers where agenttype='"& session("agenttype")&"'"
		dsagnettype.Open Sql,conn,1,1
if dsagnettype.Eof then
	ef=True
	ec="代理类型折扣为空，请先设置它！"
end if
end if


if not ef then

	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='其他产品' and username='"&session ("agentusername")&"' and id="&dsphOther("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
myrealcost=dsphOther("usermoney")*dsagnettype("pers")
else
myrealcost=dsagnpri("usermoney")
end if
dsagnpri.close

	Set dsendmoney = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_user_price where prtype='其他产品' and username='"&session("agentusername")&"' and id="&dsphOther("id")&""
		dsendmoney.Open Sql,conn,1,1
'		response.write sql
if dsendmoney.eof then
usermoney=dsphOther("usermoney")
else
usermoney=dsendmoney("usermoney")
end if
dsendmoney.close

myrealcost=Clng(FormatNumber(myrealcost,0,-1,0,0))'四舍五入'2011-8-29
'usermoney=Clng(FormatNumber(usermoney,0,-1,0,0))'四舍五入


%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html5")%>
 　开通其他类
 <%=htmlwrite("html6")%>
<br>
用户名：<%=ds("username")%> <br>
余额：
<%if trim(lcase(Request("username")))<>trim(lcase(session("agentusername"))) then%>
<%=ds("usermoney")%>
<%else%>
<%=dsagent("usermoney")%>
<%End if%>
元 <br>
电子邮件：<a href=mailto:<%=ds("email")%>><font color="#000000"><%=ds("email")%></font></a> <br>
QQ：<%=ds("qq")%> <br>
中文名：<%=ds("truename")%> <br>
联系地址：<%=ds("address")%> <br>
电话：<%=ds("tel")%> <br>
注册ip：<%=ds("regip")%> <br>
注册时间：<%=ds("regtime")%>
<form action="admOther3.asp" method="post" name="autoopen">
 <table width="100%"  border="0" cellspacing="1" bgcolor="#000000">
   <tr>
     <td width="9%" height="56" rowspan="2" bgcolor="#FAFAFA"><p>
       <%if dsphOther("canshowyear")<>"y" then%>
       <input type="hidden" name="year" value="1">
       <%else%>
<br>
　有效期限：
    
<input type="radio" name="year" value="999"  onClick="document.autoopen.usermoney.value =0;" <%if Clng(Request("year"))=999 then%>checked<%end if%>>
试用<%=Application("testtime")%>天
<input type="radio" name="year" value="<%=PAY_Month%>" onClick="document.autoopen.usermoney.value =Math.round(<%=PAY_Month*usermoney%>);" <%if Clng(Request("year"))=PAY_Month then%>checked<%end if%>>
一个月
<input type="radio" name="year" value="<%=PAY_Season%>" onClick="document.autoopen.usermoney.value =Math.round(<%=PAY_Season*usermoney%>);" <%if Clng(Request("year"))=PAY_Season then%>checked<%end if%>>
一季
<input type="radio" name="year" value="<%=PAY_halfyear%>" onClick="document.autoopen.usermoney.value =Math.round(<%=PAY_halfyear*usermoney%>);" <%if Clng(Request("year"))=PAY_halfyear then%>checked<%end if%>>
半年
<input type="radio" name="year" value="1" checked onClick="document.autoopen.usermoney.value =1*<%=usermoney%>;" <%if Clng(Request("year"))=1 then%>checked<%end if%>>
一年
<input type="radio" name="year" value="<%=PAY_2year%>" onClick="document.autoopen.usermoney.value =Math.round(<%=PAY_2year%>*<%=usermoney%>);" <%if Clng(Request("year"))=PAY_2year then%>checked<%end if%>>
两年
<input type="radio" name="year" value="<%=PAY_3year%>" onClick="document.autoopen.usermoney.value =Math.round(<%=PAY_3year%>*<%=usermoney%>);" <%if Clng(Request("year"))=PAY_3year then%>checked<%end if%>>
三年
<input type="radio" name="year" value="<%=PAY_4year%>" onClick="document.autoopen.usermoney.value =Math.round(<%=PAY_4year%>*<%=usermoney%>);" <%if Clng(Request("year"))=PAY_4year then%>checked<%end if%>>
四年
<input type="radio" name="year" value="<%=PAY_5year%>" onClick="document.autoopen.usermoney.value =Math.round(<%=PAY_5year%>*<%=usermoney%>);" <%if Clng(Request("year"))=PAY_5year then%>checked<%end if%>>
五年 <br>
<%end if%>
<br>
　<%if trim(lcase(Request("username")))<>trim(lcase(session("agentusername"))) then%>
<input name="Othertype" type="hidden" size="8" value="<%=dsphOther("id")%>">
将要开通的产品为: <b><%=dsphOther("Othertype")%> <%if Othertype<>"" then%>(<%=Othertype%>)<%end if%>
</b> 成本价格：<%=myrealcost%> 元 我的零售价格：<%=usermoney%> 元<br> 　
<input name="chmoney" type="checkbox" id="chmoney" value="y">
<font color="#FF0000">从用户金额中扣除</font>(不选将以成本价扣除代理自己的钱) 价格：
<input name="usermoney" type="text" id="usermoney" value="<%=usermoney%>" size="4" maxlength="4">
元<br><%else%>
<input name="usermoney" type="hidden" value="0">
<%end if%>

<br>
　
订单状态：
<select name="status" id="status">
  <option value="等待处理">等待处理</option>
  <option value="正常" selected>正常</option>
  <option value="暂停">暂停</option>
  <option value="过期">过期</option>
</select>
<br>
<br>
　修改用户备注：
<textarea name="userremindinfo" cols="50" id="host1"><%=userremindinfo%></textarea>
<br>
　修改订单处理信息：
<textarea name="openinfo" cols="50" id="host1"><%=openinfo%></textarea>
<br>
　内部记录：
<input name="admremindinfo" type="text" id="admremindinfo" size="70" maxlength="200">
<br>
<br>
　
<input name="openX" type="submit" value="下一步" onClick="document.autoopen.openX.value ='请等待不要重复刷新！....';document.autoopen.openX.disabled=true;document.autoopen.submit()">
<input name="username" type="hidden" size="30" value="<%=ds("username")%>">
<br>
<br>
     </p>
      </td>
   </tr>
 </table>
</form>
<%=htmlwrite("html7")%>
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
