<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%'on error resume Next


'删除时间，默认是过期30天后删除。可以修改成您要的天数
todeldate=30
if not isnull(Application("todelday")) then todeldate=Application("todelday")

If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
elseIf session("canadmhost")="" and session("onlypasusesite")="y" Then
Response.Redirect "onlypasusesite.asp"

elseIf session("canadmhost")="" And session("canadmhostadd")="" And session("canadmhostset")="" And session("canadmhostch")="" And session("canadmhostmidsub")="" And session("canadmhostmiddomain")="" And session("canadmhostmidcpu")="" And session("canadmhostmidrepay")="" And session("canadmhostdel")="" And session("canadmhostoth")="" Then
	ef=True
	ec="您没有此操作的权限。"
ElseIf Request("starttime")<>"" And Not IsDate(Request("starttime")) Then
	ef=True
	ec="时间格式无效startime"
ElseIf Request("endtime")<>"" And Not IsDate(Request("endtime")) Then
	ef=True
	ec="时间格式无效endtime"
ElseIf Request("starttime2")<>"" And Not IsDate(Request("starttime2")) Then
	ef=True
	ec="时间格式无效startime2"
ElseIf Request("endtime2")<>"" And Not IsDate(Request("endtime2")) Then
	ef=True
	ec="时间格式无效endtime2"
ElseIf Request("starttime1")<>"" And Not IsDate(Request("starttime1")) Then
	ef=True
	ec="时间格式无效startime1"
ElseIf Request("endtime1")<>"" And Not IsDate(Request("endtime1")) Then
	ef=True
	ec="时间格式无效endtime1"

ElseIf RegExpTest("[^A-Za-z0-9]",Request("username")) Then
	ef=True
	ec="用户名非法字符！"
ElseIf RegExpTest("[^A-Za-z0-9]",Request("ftpname")) Then
	ef=True
	ec="ftp名非法字符！"
ElseIf RegExpTest("[^A-Za-z0-9]",Request("ServerlistID")) Then
	ef=True
	ec="ServerlistID非法！"
end If

if not ef Then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
 
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("html8")%>
<%=htmlwrite("html9")%>
<TABLE width="100%" border=0 cellPadding=0 cellSpacing=0 background="img/midtop4.gif">
  <TBODY>
    <TR>
      <TD width=53 align="left" background="img/midtop1.gif"><strong> 　 </strong><font color="#FFFFFF">─<strong>&gt;</strong></font> </TD>
      <TD width="113"><table height="59"  border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="7" background="img/midtop.gif">&nbsp;</td>
            <td width="90" align="center" valign="middle" background="img/r3.jpg" id="tableTop1" style="Cursor:hand"><a href="netcnhost1.asp"><font color="#FFFFFF"><strong>万网主机管理</strong></font></a></td>
            <td width="5" background="img/midtop2.gif">&nbsp;</td>
          </tr>
      </table></TD>
      <TD width="93">&nbsp;	  </TD>
      <TD width="113">&nbsp;</TD>
      <TD width="83" align="left">&nbsp;</TD>
      <TD align="left">&nbsp;</TD>
      <TD width=23 align="right"><IMG height=59 
                  src="img/rtop4.jpg" 
                  width=19></TD>
    </TR>
  </TBODY>
</TABLE>
<TABLE width="100%" border=0 cellPadding=0 cellSpacing=0>
  <TBODY>
    <TR>
      <TD width=19 background="img/midlef.gif" id=rightid>&nbsp;</TD>
      <TD height="300" align="center" vAlign=top bgcolor="#FFFFFF">
<form action="netcnhost2.asp" method="post" name="form1">
<DIV class="tableborder" id="table1" <%if Request.QueryString ("op")<>"" then%> style="display:nonex"<%end if%>><table width="100%"  border="0" cellspacing="1">
        <tr >
          <td height="24" colspan="2" align="center" background="img/tablebg.gif"><font color="#FFFFFF">开通新虚拟主机</font></td>
        </tr>
        <tr bgcolor="#E4EAF2">
          <td width="9%" height="40" align="right" bgcolor="#E4EAF2">&nbsp;</td>
          <td width="91%" align="left">　用户名：
            <input name="username" type="text" id="username" size="10" maxlength="14">
产品：
<select name="productid" id="productid">

  <%
  
  Set dspdnethost = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_NetCNProductlist order by orderbyid desc"
		dspdnethost.Open Sql,conn,1,1
 While Not dspdnethost.eof%>
  
  <option value="<%=dspdnethost("productid")%>"><%=dspdnethost("Hosttype")%></option>
<%dspdnethost.movenext
wend
%>			
</select>

<input name="Submit" type="submit" id="Submit" value="下一步"></td>
        </tr>
      </table>
         </div>
</form>	
<form action="netcnhost1.asp" method="get" name="form1">
  <DIV class="tableborder"  id="table2" <%if Request.QueryString ("op")<>"" then%> style="display:none"<%end if%>>
    <table width="100%"  border="0" cellspacing="1">
      <tr >
        <td height="24" colspan="2" align="center" background="img/tablebg.gif"><font color="#FFFFFF">暂停/恢复/修改/删除 虚拟主机</font></td>
      </tr>
      <tr bgcolor="#E4EAF2">
        <td width="9%" height="40" align="right" bgcolor="#E4EAF2">&nbsp;</td>
        <td width="91%" align="left">　用户名：
          <input name="username" type="text" id="username" size="10" maxlength="14">
          或FTP用户名：
          <input name="ftpname" type="text" id="ftpname" value="" size="14" maxlength="30">
          或域名：
          <input name="hostname" type="text" id="hostname" value="" size="14" maxlength="30">
          <input name="Submit" type="submit" id="Submit" value="下一步"></td>
      </tr>
    </table>
  </div>
</form>
<%if session("cansysteminfo")="y" then%>
<%if Request.QueryString ("op")<>"" then%><DIV class="tableborder" id="table3"  style="display:"><%else%><DIV class="tableborder" id="table3"  style="display:none"><%end if%>
<table width="100%"  border="0" cellspacing="1">
      <tr >
        <td height="24" colspan="2" align="center" background="img/tablebg.gif"><font color="#FFFFFF">虚拟主机到期处理</font></td>
      </tr>
      <tr bgcolor="#E4EAF2">
        <td width="9%" height="130" align="right" bgcolor="#E4EAF2">&nbsp;</td>
        <td width="91%" align="left">
            　<a href="netcnhost1.asp?op=del"><font color="#000000">到期应该删除的虚拟主机>>></font> </a> <br>            <br><br>
　<a href="netcnhost1.asp?op=pause"><font color="#000000">到期应该暂停的虚拟主机>>></font> </a> (此功能只有在自动任务模块停止的情况下才需要使用)<br>			
            　<a href="gemail.asp?type=host&da=30"><font color="#000000">群发邮件给一个月后到期的用户>>></font> </a> (此功能只有在自动任务模块停止的情况下才需要使用)<br>
            　<a href="gemail.asp?type=host&da=7"><font color="#000000">群发邮件给一周后到期的用户>>></font> </a> (此功能只有在自动任务模块停止的情况下才需要使用)<br>            <br>
            　<a href="admhostlistFunction.asp?op=all" target="_blank"><font color="#000000">删除的操作日志>>></font> </a> </td>
      </tr>
    </table>
</div><br>
<br>


<%
	Set dsph = Server.CreateObject("ADODB.Recordset")
SQL="Select * from FreeHost.FreeHost_Product_NETCN where "
if Request.QueryString ("username")<>"" then Sql=Sql+"username= '"&trim(Request.QueryString ("username"))&"' and "
if Request.QueryString ("hostname")<>"" then Sql=Sql+"domain like '%"&ComX.idntoac_7i24_com(cstr(hostname))&"%' and "
if Request.QueryString ("ftpname")<>"" then Sql=Sql+"ftpname like '%"&trim(Request.QueryString ("ftpname"))&"%' and "

'if Request.QueryString ("productid")<>"" then Sql=Sql+"productid = '"&trim(Request.QueryString ("productid"))&"' and "

if Request.QueryString ("status")<>"" then
if Request.QueryString ("status")="过期暂停" then
Sql=Sql+"istest = 'n' and endtime < '"&now&"' and status = '暂停' and "
elseif Request.QueryString ("status")="过期未暂停" then
Sql=Sql+"istest = 'n' and endtime < '"&now&"' and status = '正常' and "
elseif Request.QueryString ("status")="试用过期未暂停" then
Sql=Sql+"endtime < '"&now&"' and istest = 'y' and status = '正常' and "
elseif Request.QueryString ("status")="试用过期已暂停" then
Sql=Sql+"endtime < '"&now&"' and istest = 'y' and status = '暂停' and "
elseif Request.QueryString ("status")="试用过期" then
Sql=Sql+"endtime < '"&now&"' and istest = 'y' and "
elseif Request.QueryString ("status")="试用" then
Sql=Sql+"endtime > '"&now&"' and istest = 'y' and "
'else
'Sql=Sql+"istest = 'n' and status = '"&trim(Request.QueryString ("status"))&"' and "
end if
end if

'if Request.QueryString ("beianstatus")<>"" and Request.QueryString ("beianstatus")<>"没有备案" then Sql=Sql+"beianstatus = '"&trim(Request.QueryString ("beianstatus"))&"' and "
if Request.QueryString ("beianstatus")="没有备案" then Sql=Sql+"beianstatus is null and "
if Request.QueryString ("starttime2") <>"" then  Sql=Sql+"productid<>'子目录绑定' and starttime>'"&Request.QUERYSTRING ("starttime1")&"' and starttime<'"&Request.QUERYSTRING ("starttime2")&"' and "
if Request.QueryString ("endtime2") <>"" then  Sql=Sql+"productid<>'子目录绑定' and endtime>'"&Request.QUERYSTRING ("endtime1")&"' and endtime<'"&Request.QUERYSTRING ("endtime2")&"' and "
if Request.QueryString ("starttime") <>"" then  Sql=Sql+"productid<>'子目录绑定' and starttime>'"&Request.QUERYSTRING ("starttime")&"' and "
if Request.QueryString ("endtime") <>"" then  Sql=Sql+"productid<>'子目录绑定' and endtime<'"&Request.QUERYSTRING ("endtime")&"' and "
if right(sql,5)=" and " then sql=left(sql,len(sql)-5)&" order by endtime desc "
if right(SQL,6)="where " then  SQL="Select * from FreeHost.FreeHost_Product_NETCN order by id desc"

if Request.QueryString ("op") ="all" then Sql="Select * from FreeHost.FreeHost_Product_NETCN order by id desc"
if Request.QueryString ("op") ="pause" then Sql="Select * from FreeHost.FreeHost_Product_NETCN where productid<>'子目录绑定' and endtime<'"&now&"' order by endtime desc"
if Request.QueryString ("op") ="del" then Sql="Select * from FreeHost.FreeHost_Product_NETCN where productid<>'子目录绑定' and endtime<'"&dateadd("d",-todeldate,now)&"' order by endtime desc"
if Request.QueryString ("op") ="willpause" then Sql="Select * from FreeHost.FreeHost_Product_NETCN where productid<>'子目录绑定' and endtime<'"&dateadd("d",30,now)&"' order by endtime desc "

'Response.Write sql
	if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
	dsph.PageSize = 25
        dsph.Open Sql,conn,1,1
if not dsph.eof then
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%>">下一页</a><%End If%>
<%if Request.QueryString ("op") ="" then%><a href="netcnhost1.asp?starttime=<%=formatdatetime(now,2)%>"><font color="#000000">今天新开通</font></a> | <a href="netcnhost1.asp?starttime=<%=formatdatetime(dateadd("d",-7,now),2)%>"><font color="#000000">一周新开通</font></a> | <a href="netcnhost1.asp?endtime=<%=formatdatetime(dateadd("d",7,now),2)%>"><font color="#000000">一周到期</font></a> | <a href="netcnhost1.asp?endtime=<%=formatdatetime(dateadd("d",30,now),2)%>"><font color="#000000">30天到期</font></a><%end if%>
<DIV class="tableborder">
<table width="100%" border="0" cellspacing="1" cellpadding="2" align="center">
  <tr bgcolor="#C1BFBF" align="center">
    <td width="14%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">产品类型</font></td>
    <td width="11%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">用户名</font></td>
    <td width="19%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">域　名</font></td>
    <td width="8%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">FTP用户名</font></td>
    <td width="7%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">IP 地址</font></td>
    <td width="11%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">开通日期</font></td>
    <td width="12%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">到期日期</font></td>
    <td width="6%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">状态</font></td>
    <td width="6%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">操作</font></td>
    <td width="6%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">操作</font></td>
  </tr>
<% 
For N=1 To dsph.PageSize 
					If dsph.RecordCount=0 Then Exit For
%>
<%
	productid=dsph("productid")
	Set ori_host_name = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_NetCNProductlist where productid='"&dsph("productid")&"'"
		ori_host_name.Open Sql,conn,1,1
		if not ori_host_name.eof Then
Hosttype=ori_host_name("Hosttype")		
HosttypeORI=ori_host_name("HosttypeORI")		
'Set newname_host = Server.CreateObject("ADODB.Recordset")	
'Sql="Select * from FreeHost.FreeHost_NetCNProductlist_AGN where agent1='"&dsph("agent1")&"' 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
	%>
  <tr align="center" bgcolor="#E4EAF2" onmouseover=this.bgColor='#cccccc'; onmouseout=this.bgColor='#E4EAF2';>
    <td><%=Hosttype%><br><%if HosttypeORI<>Hosttype then%><%=HosttypeORI%><%end if%></td>
    <td height="30"><a href="searchuser.asp?username=<%=dsph("username")%>"><%=dsph("username")%></a><br>
<%if dsph("agent1")<>"n" then%>
(<a href="searchagent.asp?username=<%=dsph("agent1")%>" target="_blank"><font color="#FF0000"><%=dsph("agent1")%></font></a>)
<%end if%>

</td>
    <td><a href="http://<%=dsph("domain")%>" target=_blank><%=dsph("domain")%></a></td>
<td><%=dsph("ftpname")%><br>
      <%=dsph("ftppassword")%><br>
      <a target="_blank" href="ftp://<%=dsph("ftpname")%>:<%=dsph("ftppassword")%>@<%=lcase(dsph("ipaddress"))%>"> 连接FTP</a></td>
    <td>
      <%=dsph("ipaddress")%>
      <br></td>
    <td><%=formatdatetime(dsph("starttime"),1)%></td>
    <td><%If Not IsNull(dsph("endtime")) then%><%=formatdatetime(dsph("endtime"),1)%><%End if%></td>
    <td><%if dsph("endtime")>NOW then%>
      
      <%=dsph("status")%>

      <%else%>
      <font color="#FF0000">过期</font>
      <%if dsph("status")="暂停" then%>
      <br>
      <font color="#FF0000">暂停</font>
      <%end if%>
      <%end if%></td>
    <td><a href="http://cp.hichina.com/login.asp?username=<%=dsph("ftpname")%>" target=_blank><font color="#000000">登陆面板</font></a></td>
    <td><a href="handhostnetcn1.asp?username=<%=dsph("username")%>&id=<%=dsph("id")%>"><font color="#000000">管理</font></a>      <!--<a href="handhost1.asp?username=<%=dsph("username")%>&id=<%=dsph("id")%>"><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>
</div>

<%dsph.close
set dsph=nothing
else%>
<DIV class="tableborder"><br>
<br>
没有相关的记录。<br>
<br>
</div>
<%end if%><br>
	  <%else%>
	  您没有查看新开产品的权限.
	  <%end if%>

</TD>
      <TD width=18 background="img/midri.gif">&nbsp;</TD>
    </TR>
  </TBODY>
</TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
    <TR>
      <TD width=30><IMG height=19 
                  src="img/rb1.jpg" 
                  width=30></TD>
      <TD 
                background=img/rb2.jpg>&nbsp;</TD>
      <TD width=30><IMG height=19 
                  src="img/rb3.jpg" 
                  width=30></TD>
    </TR>
  </TBODY>
</TABLE>
            <%=htmlwrite("html10")%>
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
