<%@ 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="数据库面板中不能操作用户区的内容，请您先登陆用户区。"
end If

If RegExpTest("[^A-Za-z0-9]",Request("ftpname")) Then 
	ef=True
	ec="ftp名中有非法字符！"
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")%>
虚拟主机管理
<%=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_Host where username='"&session("username")&"' and Hosttype<>'子目录绑定' order by endtime desc"
if Request("ftpname")<>""   then	Sql="Select * from FreeHost.FreeHost_Product_Host where username='"&session("username")&"' and Hosttype<>'子目录绑定' and  ftpname like '%"&Request("ftpname")&"%'"
if Request("hostname")<>"" then	Sql="Select * from FreeHost.FreeHost_Product_Host where username='"&session("username")&"' and Hosttype<>'子目录绑定' and  hostname like '%"&ComX.idntoac_7i24_com(cstr(hostname))&"%'"
if Request("orderby")="asc"  then Sql="Select * from FreeHost.FreeHost_Product_Host where username='"&session("username")&"' and Hosttype<>'子目录绑定' order by id asc"
if Request("orderby")="desc"  then Sql="Select * from FreeHost.FreeHost_Product_Host where username='"&session("username")&"' and Hosttype<>'子目录绑定' and endtime<'"&formatdatetime(dateadd("d",7,now),2)&"' order by endtime desc"
			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
if Request("orderby")="desc"  Then 	dsph.PageSize = 500
	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 Request("orderby")="asc" then%><a href="?orderby=desc">一周内到期</a><%elseif Request("orderby")="desc" then%><a href="?orderby=asc">按开通时间排</a><%else%><a href="?orderby=asc">按开通时间排</a>　<a href="?orderby=desc">一周内到期</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">FTP名密码</td>
    <td>IP 地址</td>
    <td>开通/到期</td>
    <td>状态</td>
    <td>操作</td>
    <td>操作</td>
    <td>操作</td>
    <td>ICP</td>
  </tr>
<%
For N=1 To dsph.PageSize 
					If dsph.RecordCount=0 Then Exit For
%>
<%
canshowbeian=true
	Hosttype=dsph("Hosttype")
	Set ori_host_name = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_HostProductlist where Hosttype='"&dsph("Hosttype")&"'"
		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_HostProductlist_AGN where agent1='"&session("agentname")&"' and id='"&ori_host_name("id")&"'"
		newname_host.Open Sql,conn,1,1
if not newname_host.eof then
Hosttype=newname_host("Hosttype")
end if
		end if
hostname=dsph("hostname")
If isnull(dsph("hostname")) Then hostname=""
hostname=replace(hostname, ":80:","")
hostname_arry=Split(hostname, ",")

canshowbeian=true
If ori_host_name("isagentpd")=False then
	Set dsserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Serverlist where id='"&dsph ("ServerlistID")&"'"
	dsserver.Open Sql,conn,1,1
	ostype=dsserver("ostype")
	useisp=dsserver("useisp")
isuseCDN=dsserver("isuseCDN")
localserverip=dsserver("ip")
autodelicp=dsserver("autodelicp")
if autodelicp=true or dsserver("openmustre")=true then
canshowbeian=false
end if
dsserver.close
End if
	%>
  <tr align="center" bgcolor="#FFFFFF">
    <td height="45"><%=Hosttype%></td>
    <td><%If ori_host_name("isagentpd")=False Then
    if ostype="linux" and autodelicp=true then
	Set dsICPDB = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_ICPDB where ftpname='"&dsph("ftpname")&"'"
	dsICPDB.Open Sql,conn,1,1
if dsICPDB.eof then%>
<%for idname=0 to ubound(hostname_arry)%>
      <a href="http://<%=hostname_arry(idname)%>" target="_blank">
      <%if ComX.actoidc_7i24_com(cstr(hostname_arry(idname)))<>hostname_arry(idname) then%>
      <%=ComX.actoidc_7i24_com(cstr(hostname_arry(idname)))%> (<%=hostname_arry(idname)%>)
      <%else%>
      <%=hostname_arry(idname)%>
      <%end if%>
      </a><br>
      <%next%>
<%end if
while not dsICPDB.Eof%>
主域名:<%=dsICPDB("domain")%><br>
备案:<%=dsICPDB("status")%><br>
<%dsICPDB.movenext
wend
dsICPDB.close	
	%>	
	<%else%><%for idname=0 to ubound(hostname_arry)%>
      <a href="http://<%=hostname_arry(idname)%>" target="_blank">
      <%if ComX.actoidc_7i24_com(cstr(hostname_arry(idname)))<>hostname_arry(idname) then%>
      <%=ComX.actoidc_7i24_com(cstr(hostname_arry(idname)))%> (<%=hostname_arry(idname)%>)
      <%else%>
      <%=hostname_arry(idname)%>
      <%end if%>
      </a><br>
      <%next%><%end if%><%end if%></td>
    <td><%=dsph("ftpname")%><br>
    <%=dsph("ftppassword")%></td>
    <td>
<%if isuseCDN=true then%>请用面板中的别名解析<%else%>
<%
	Set dsX = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Product_Host_IP where HostID="&dsph("id")
		dsX.Open Sql,conn,1,1
If dsX.Eof Then%>
<%
'服务器
%><%=localserverip%><%


 
%>
<%else
while not dsX.eof
%>
<%=dsX("IP")%> <br>
<%
dsX.movenext
wend
end if
end if%>
</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="hostadm2.asp?id=<%=dsph("id")%>&go=c"><font color="#000000">延期<%if ostype="linux" then%><br>
或改密码<%end if%></font></a></td>
    <td><a href="hostadm2.asp?id=<%=dsph("id")%>&go=d"><font color="#000000">升级</font></a></td>
    <td><a href="hostadm2.asp?id=<%=dsph("id")%>&go=a"><font color="#000000">管理</font></a></td>
    <td><a href="hostadm2.asp?id=<%=dsph("id")%>&go=b"><%if dsph("beianstatus")="备案成功" then%><FONT color=red>成功</FONT><%else%>
	<%if useisp=true then%><a href="/beianuser/info.asp"><font color="#000000">进入备案系统</font></a>
      <%else%>
	<%if canshowbeian=true Or Application("icpbyhost")=1 or Application("icpbyhost")=-1 then%><%=dsph("beianstatus")%><%If isnull(dsph("beianstatus")) then%>尚未录入备案信息<%End if%><%else%><a href="ispinfo.asp?id=<%=dsph("id")%>">自行到工信部备案</a><%end if%><%end if%><%end if%>
	</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="hostadm.asp" method="get" name="form1">
  <table width="100%" height="20"  border="0" cellpadding="0" cellspacing="0">
    <tr bgcolor="">
      <td>查找虚拟主机：</td>
    </tr>
  </table>
  <table width="100%"  border="0" cellspacing="1" bgcolor="#CCCCCC">
    <tr>
      <td width="9%" height="30" rowspan="2" bgcolor="#FFFFFF"><p>　FTP用户名：
              <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%>
