<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
If session("username")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
If session("HOSTAUID")<>"" Then ec="主机面板中不能操作用户区的内容，请您先登陆用户区。"
If session("EmailAUID")<>"" Then ec="邮箱面板中不能操作用户区的内容，请您先登陆用户区。"
If session("SQLAUID")<>"" Then ec="数据库面板中不能操作用户区的内容，请您先登陆用户区。"
If session("CDNAUID")<>"" Then ec="CDN面板中不能操作用户区的内容，请您先登陆用户区。"
end If

If RegExpTest("[^A-Za-z0-9]",Request("ftpname")) Then 
	ef=True
	ec="CDN名中有非法字符！"
End if


if not ef then
 
hostname=trim(replace(Request("hostname"),"http://",""))
if hostname<>"" then hostname=ComX.idntoac_7i24_com(cstr(hostname))
hostnamecheck=replace(hostname,".","")
hostnamecheck=replace(hostnamecheck,"xn--","")
If RegExpTest("[^A-Za-z0-9--]",hostnamecheck) Then
	ef=True
	ec="请输入合法的域名！"
end if
end if

if not ef then
%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html2")%>
CDN管理
<%=htmlwrite("html3")%><br>
<br>
<%Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
Set dsph = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_Product_CDN where username='"&session("username")&"' and CDNtype<>'子目录绑定' order by endtime desc"
if Request("ftpname")<>""   then	Sql="Select * from FreeHost.FreeHost_Product_CDN where username='"&session("username")&"' and CDNtype<>'子目录绑定' and  ftpname like '%"&Request("ftpname")&"%'"
if Request("hostname")<>"" then	Sql="Select * from FreeHost.FreeHost_Product_CDN where username='"&session("username")&"' and CDNtype<>'子目录绑定' and  hostname like '%"&ComX.idntoac_7i24_com(cstr(hostname))&"%'"
			if Instr(1,sql, ";", 1)>0 or Instr(1,replace(sql,"xn--",""), "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end If

'response.write sql

	dsph.PageSize = 25
	dsph.Open Sql,conn,1,1
if dsph.Eof then%>
没有开通的虚拟主机.	
<%else%>
<%
if Request.ServerVariables("QUERY_STRING")<>"" then
ask=Split(Request.ServerVariables("QUERY_STRING"), chr(38)&"pn")
else
ask=Split("freehost=1", "")
ask(0)="freehost=lsoft"
end if
	pn=1
if Request.QueryString ("pn")<>"" then pn=Request.QueryString ("pn")
If dsph.RecordCount <> 0 Then dsph.AbsolutePage = CLng(pn)  
    if clng(pn)<=10 then
    begini=1
      if dsph.PageCount<=10 then
       endini=dsph.PageCount 
       else
       endini=10
      end if
    end if
%>
<%if clng(pn)<=10 then%>最新 <%for i=begini to endini
    if clng(pn)=i then%><font color=red>[<%=i%>]</font><%else%><a href="?<%=ask(0)%>&pn=<%=i%>"><font color="#000000">[<%=i%>]</font></a><%end if%>　<%next%> 
        <%else%>　<a href="?<%=ask(0)%>&pn=1"><font color="#000000">最新[1]--[10]</font></a>　　现在是第<font color=red>[<%=pn%>]</font>页 
        　共<%=dsph.PageCount%>页　<%end if%><%If Clng(pn)>1 Then%><a href="?<%=ask(0)%>&pn=<%=pn-1%>">上一页</a><%End If%>|<%If Clng(pn)<dsph.PageCount Then%><a href="?<%=ask(0)%>&pn=<%=pn+1%>"><font color="#000000">下一页</font></a>
        <%End If%>　　　<%if Application("openispsystem")=true then%><a href="/beianuser/info.asp"><font color=red>进入备案系统>>>></font></a><%end if%>
<table width="100%" border="0" cellspacing="1" cellpadding="2" align="center" bgcolor="#CCCCCC">
  <tr bgcolor="#EEEEEE" align="center">
    <td height="21">产品类型</td>
    <td bgcolor="#EEEEEE">域　名</td>
    <td height="21">CNAME域名</td>
    <td>CDN名密码</td>
    <td>开通/到期</td>
    <td>状态</td>
    <td>操作</td>
    <td>操作</td>
    <td>操作</td>
  </tr>
<%
For N=1 To dsph.PageSize 
					If dsph.RecordCount=0 Then Exit For
%>
<%
canshowbeian=true
	CDNtype=dsph("CDNtype")
	Set ori_host_name = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_CDNProductlist where CDNtype='"&dsph("CDNtype")&"'"
		ori_host_name.Open Sql,conn,1,1
		if not ori_host_name.eof then
Set newname_host = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_CDNProductlist_AGN where agent1='"&session("agentname")&"' and id='"&ori_host_name("id")&"'"
		newname_host.Open Sql,conn,1,1
if not newname_host.eof then
CDNtype=newname_host("CDNtype")
end if
		end if
	%>
  <tr align="center" bgcolor="#FFFFFF">
    <td height="45"><%=CDNtype%></td>
    <td>
<%
hostname=dsph("hostname")
If IsNull(dsph("hostname")) Then hostname=""
'hostname=replace(hostname, ":80:","")
hostname_arry=Split(hostname, ",")

for idname=0 to ubound(hostname_arry)
domary=Split(hostname_arry(idname),":")

domain=domary(UBound(domary))
ipstrall=Left(hostname_arry(idname),Len(hostname_arry(idname))-Len(domain)-1)
ipary=Split(ipstrall,"|")
iparyTel=Split(ipary(0),":")
ipTel=iparyTel(0)
portTel=iparyTel(1)
ipCNC=""
portCNC=""
ipMOB=""
portMOB=""
ipUSA=""
portUSA=""
For sourceI=1 To UBound(ipary)
If InStr(ipary(sourceI),"NC-") then
iparyCNC=Split(ipary(sourceI),":")
ipCNC=Replace(iparyCNC(0),"CNC-","")
portCNC=iparyCNC(1)
End If
If InStr(ipary(sourceI),"OB-") then
iparyMOB=Split(ipary(sourceI),":")
ipMOB=Replace(iparyMOB(0),"MOB-","")
portMOB=iparyMOB(1)
End If
If InStr(ipary(sourceI),"SA-") Then
iparyUSA=Split(ipary(sourceI),":")
ipUSA=Replace(iparyUSA(0),"USA-","")
portUSA=iparyUSA(1)
End If
next




%>

<a href="http://<%=domain%>" target="_blank"><%if ComX.actoidc_7i24_com(cstr(domain))<>domain then%>
          <%=ComX.actoidc_7i24_com(cstr(domain))%> (<%=domain%>)
          <%else%>
          <%=domain%>
          <%end if%></a><br>(源IP：<%=ipTel%> 端口：<%=portTel%>)
<%If ipCNC<>"" then%><br>(源联通IP：<%=ipCNC%> 端口：<%=portCNC%>)<%End if%>
<%If ipMOB<>"" then%><br>(源移动IP：<%=ipMOB%> 端口：<%=portMOB%>)<%End if%>
<%If ipUSA<>"" then%><br>(源外国IP：<%=ipUSA%> 端口：<%=portUSA%>)<%End if%><br>

      <%next%>
	  </td>
    <td><%
	Set dsserver = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_ServerBindlist where id='"&dsph ("Bindserverid1")&"'"
	dsserver.Open Sql,conn,1,1
%>
    <%=dsserver("aname")%>.<%=dsserver("domain")%> </td>
    <td><%=dsph("ftpname")%><br>
      <%=dsph("ftppassword")%><br>

</td>
    <td><%=formatdatetime(dsph("starttime"),1)%><br>
    <%=formatdatetime(dsph("endtime"),1)%></td>
    <td><%if dsph("endtime")>NOW then%>
      <%if dsph("istest")="y" then%>
      <font color="#FF0000">试用</font><%else%>
      <%=dsph("status")%>
      <%end if%>
      <%else%>
      <font color="#FF0000">过期</font>
      <%if dsph("status")="暂停" then%>
      <br>
      <font color="#FF0000">暂停</font>
      <%end if%>
      <%end if%></td>
    <td><a href="CDNadm2.asp?id=<%=dsph("id")%>&go=c"><font color="#000000">延期<%if ostype="linux" then%><br>
或改密码<%end if%></font></a></td>
    <td><a href="CDNadm2.asp?id=<%=dsph("id")%>&go=d"><font color="#000000">升级</font></a></td>
    <td><a href="CDNadm2.asp?id=<%=dsph("id")%>&go=a"><font color="#000000">管理</font></a></td>
  </tr>
<%
If clng(pn)=dsph.PageCount Then
I = dsph.RecordCount - (dsph.PageCount-1) * dsph.PageSize
If N=I Then Exit For
End If
dsph.movenext
Next%>
</table>
<%dsph.close
set dsph=nothing
end if
%>
<br><br>
<br>
<form action="CDNadm.asp" method="get" name="form1">
  <table width="100%" height="20"  border="0" cellpadding="0" cellspacing="0">
    <tr bgcolor="">
      <td>查找CDN产品：</td>
    </tr>
  </table>
  <table width="100%"  border="0" cellspacing="1" bgcolor="#CCCCCC">
    <tr>
      <td width="9%" height="30" rowspan="2" bgcolor="#FFFFFF"><p>　CDN用户名：
              <input name="ftpname" type="text" id="ftpname" size="10">
          或域名
          <input name="hostname" type="text" id="hostname">
          <input type="submit" name="Submit" value="查找">
      </p></td>
    </tr>
  </table>
</form>
<br>
<%=htmlwrite("html4")%>
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
