<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunction.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
 

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

If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
ElseIf not IsNumeric(Request("id"))  Then
	ef=True
	ec="产品ID应该是数字！"	
elseIf session("onlypasusesite")="" Then
	ef=True
	ec="您没有此操作的权限。"
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
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")

if Request.Form ("Submit")="暂停" or Request.Form ("Submit")="恢复" then
if not ef then
	Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Host where id='"&Request("id")&"'"
	dsph.Open Sql,conn,1,3
if dsph.Eof then
	ef=True
	ec="不存在的虚拟主机ID！"
end if
end if

if not ef then
	Set dsserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Serverlist where id='"&dsph ("ServerlistID")&"'"
	dsserver.Open Sql,conn,1,1
if dsserver.Eof then
	ef=True
	ec="服务器不存在！"
else
username=dsph("Ftpname")
FreeHostsharekey=dsserver("FreeHostsharekey")
URL=dsserver("site")
tourl=dsserver(""&Request.Form ("pauseweb")&"")
password=Request.Form ("password")
homedir=dsserver("homedir") 
IISID=dsph("IISID")
	ostype=dsserver("ostype")'linux
end if
end if
end if


if not ef then


if Request.Form ("Submit")="暂停" Then

FreeHost_oplog session("admusername"),"信息","独立管理员暂停网站FTP用户名："&dsph ("Ftpname")

op=1
if dsph("Hosttype")="子目录绑定" then
Response.Write PauseSiteSub(URL,FreeHostsharekey,IISID,tourl,op)
else
Response.Write PauseSite(URL,FreeHostsharekey,username,tourl,op)
end if
dsph("status")="暂停"
dsph("pausebyagn")="a"
dsph.update

'处理子目录绑定
Set dsphsub = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Host where allowsubbyid='"&dsph("id")&"'"
	dsphsub.Open Sql,conn,1,3
while not dsphsub.eof
IISID=dsphsub("IISID")
Response.Write PauseSiteSub(URL,FreeHostsharekey,IISID,tourl,op)
dsphsub("status")="暂停"
dsphsub("pausebyagn")="a"
dsphsub.update
dsphsub.movenext
wend
dsphsub.close

end if

if Request.Form ("Submit")="恢复" Then

FreeHost_oplog session("admusername"),"信息","独立管理员恢复网站FTP用户名："&dsph ("Ftpname")

op=0
if dsph("Hosttype")="子目录绑定" then
Response.Write PauseSiteSub(URL,FreeHostsharekey,IISID,tourl,op)
Response.Write OPSiteSub(URL,FreeHostsharekey,IISID,op)
else
Response.Write PauseSite(URL,FreeHostsharekey,username,tourl,op)
Response.Write OPSite(URL,FreeHostsharekey,username,op)
Response.Write FTPOP(URL,FreeHostsharekey,username,0)
end if
dsph("status")="正常"
dsph("pausebyagn")="n"
dsph.update
'处理子目录绑定
Set dsphsub = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Host where allowsubbyid='"&dsph("id")&"'"
	dsphsub.Open Sql,conn,1,3
while not dsphsub.eof
IISID=dsphsub("IISID")
Response.Write PauseSiteSub(URL,FreeHostsharekey,IISID,tourl,op)
Response.Write OPSiteSub(URL,FreeHostsharekey,IISID,op)
dsphsub("status")="正常"
dsphsub("pausebyagn")="n"
dsphsub.update
dsphsub.movenext
wend
dsphsub.close
dsph.update
dsph.close
end if
if Request.Form ("Submit")="暂停" or Request.Form ("Submit")="恢复" then Response.end


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="admhost.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="onlypasusesite.asp" method="get" name="form1">
  <DIV class="tableborder"  id="table2">
    <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 not ef then
	Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Host where username='"&Request.QueryString ("username")&"'"
if Request.QueryString ("id") <>"" then Sql="Select * from FreeHost.FreeHost_Product_Host where id='"&Request.QueryString ("id")&"'"
if Request.QueryString ("ftpname") <>"" then Sql="Select * from FreeHost.FreeHost_Product_Host where ftpname='"&Request.QueryString ("ftpname")&"'"
if Request.QueryString ("hostname")<>"" then Sql="Select * from FreeHost.FreeHost_Product_Host where 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
	dsph.Open Sql,conn,1,1
if dsph.Eof then%>

<%end if
end if

%>

<form action="onlypasusesite.asp" method="post" name="form1">
<%if not dsph.eof then%>
<DIV class="tableborder">
<table width="100%" border="0" cellspacing="1" cellpadding="2" align="center">
  <tr bgcolor="#C1BFBF" align="center">
    <td height="24" colspan="2" background="img/tablebg.gif"><font color="#FFFFFF">编号</font></td>
    <td background="img/tablebg.gif"><font color="#FFFFFF">产品类型</font></td>
    <td width="8%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">用户名</font></td>
    <td width="10%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">域　名</font></td>
    <td width="9%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">FTP用户名</font></td>
    <td width="8%" 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="7%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">状态</font></td>
    </tr>
<%

while not dsph.Eof%><%
ishavesite=true
	Hosttype=dsph("Hosttype")

hostname=dsph("hostname")
hostname=replace(hostname, ":80:","")
hostname_arry=Split(hostname, ",")

	%>
  <tr align="center" bgcolor="#E4EAF2" title="<%=dsph("corewhat")%>">
    <td width="6%"><%=dsph("id")%></td>
    <td width="4%"><input type="radio" name="id" value="<%=dsph("id")%>" <%if dsph.RecordCount=1 then%>checked<%end if%>></td>
    <td><%=Hosttype%><%if isAgnHostSer then%><br>
(独立模式)<%end if%>
<%if dsph("allowsub")="y" then%>
　 <br>
允许绑定子目录 <%=dsph("subweb")%> 个
<%end if%><br>

<%if not isnull(dsph("repaymoney")) then%>
此产品已设置了单独续费价格：<%=dsph("repaymoney")%>元/年
<%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%>
<%if not isnull(dsph("kefu")) then%>
<br>
<a href="admkefu.asp?kefu=<%=dsph("kefu")%>">(<font color="#0000FF"><%=dsph("kefu")%>)</font></a>
<%end if%></td>
    <td><%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%></td><%
	Set dsserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Serverlist where id='"&dsph ("ServerlistID")&"'"
	dsserver.Open Sql,conn,1,1
%>
    <td bgcolor="#E4EAF2"><%=dsph("ftpname")%><br>      </td>
    <td>      
      <%=dsserver("ip")%>
      <%dsserver.close%>
      <br>      <br></td>
    <td width="11%"><%=dsph("starttime")%><br>
      <%=dsph("endtime")%></td>
    <td width="7%"><%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>
    </tr>
<%dsph.movenext

wend%>  
  
</table>
</div>

<%dsph.close
set dsph=nothing
else

if request.QueryString<>"" then
%>
<DIV class="tableborder"><br>
<br>
没有相关的记录。<br>
<br>
</div>
<%end if%>
<%end if%>
<br>
<%if ishavesite=true then%>
<DIV class="tableborder">
<table width="100%" border="0" cellspacing="1" cellpadding="2" align="center">
  <tr align="center" bgcolor="#E4EAF2">
    <td width="15%" height="70">暂停/恢复</td>
    <td height="30" align="left">　
      
如果是暂停可以选择暂停的原因：<br>
　
<input name="pauseweb" type="radio" value="pauseweb" checked>
超过使用期限
<input name="pauseweb" type="radio" value="pauseweb2">
政治或色情
<input name="pauseweb" type="radio" value="pauseweb3">
上传引起不稳定的程序或其他原因<br>
　
<input name="pauseweb" type="radio" value="pauseweb4">
没有备案或备案不成功
<input type="submit" name="Submit" value="暂停">
<input type="submit" name="Submit" value="恢复"> 　
</td>
  </tr>

  <tr align="center" bgcolor="#E4EAF2">
    <td height="30" colspan="2" align="right"><a href="#top"><font color="#6B9EDE" face="Arial, Helvetica, sans-serif">Top↑</font></a></td>
    </tr>
</table>
</div>
</form>
<%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%>
