<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunction.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
server.ScriptTimeout =7200
Function RBSALL(URL,FreeHostsharekey,rbsvar)
Set MaintoCSCom=Server.CreateObject("www.7i24.com")
body=URLEncoding("rbsvar="&rbsvar)
RetInfo=MaintoCSCom.DOHTTPSSL(Url&"?RBSALL",FreeHostsharekey,body,FreeHost_t1,FreeHost_t2,FreeHost_t3,FreeHost_t4)
Set MaintoCSCom =Nothing
RBSALL=RetInfo
End Function

Function BUILDALLACL(URL,FreeHostsharekey,var)
Set MaintoCSCom=Server.CreateObject("www.7i24.com")
body=URLEncoding("var="&var)
RetInfo=MaintoCSCom.DOHTTPSSL(Url&"?BUILDALLACL",FreeHostsharekey,body,FreeHost_t1,FreeHost_t2,FreeHost_t3,FreeHost_t4)
Set MaintoCSCom =Nothing
BUILDALLACL=RetInfo
End Function

If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
ElseIf Instr(1, Request.QueryString ("pn"), "'", 1)>0 then
	ef=True
	ec="产品类型有非法字符！"
ElseIf not IsNumeric(Request("ServerlistID")) Then
	ef=True
	ec="编号必须是数字"
elseIf session("canrebuild")="" Then
	ef=True
	ec="您没有此操作的权限。"
end if
if not ef then
'pn=Request.QueryString ("pn")
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
'	Set dsph = Server.CreateObject("ADODB.Recordset")	
'Sql="Select * from FreeHost.FreeHost_Product_Host where serverlistid='"&Request.QueryString("ServerlistID")&"' and hosttype<>'子目录绑定' order by id desc"
'	dsph.PageSize = 25
'	dsph.Open Sql,conn,1,1
'if dsph.Eof then
'	ef=True
'	ec="此服务器并没有开通虚拟主机！"
'end if
end if

if not ef then
	Set dsserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Serverlist where id='"&Request("ServerlistID")&"'"
	If Clng(Request("ServerlistID"))=0 Then Sql="Select * from FreeHost.FreeHost_Serverlist"
	dsserver.Open Sql,conn,1,1
if dsserver.Eof 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 align="left"><table height="59"  border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="7" background="img/midtop.gif">&nbsp;</td>
            <td width="80" align="center" valign="middle" background="img/r3.jpg" id="tableTop1" style="Cursor:hand"><a href="rebuild.asp"><font color="#FFFFFF">重建用户</font></a><a href="serverlist.asp"></a></td>
            <td width="5" background="img/midtop2.gif">&nbsp;</td>
          </tr>
      </table></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"><br>
<br>

<DIV class="tableborder"><br>
<br>
<br>

<%

While Not dsserver.Eof

URL=dsserver("site")
FreeHostsharekey=dsserver("FreeHostsharekey")

if Request("Submit")="马上重新计算所有用户的占用配额" then

returnstr =  RBSALL(URL,FreeHostsharekey,rbsvar)
if (instr(1,returnstr,"NOT IMPLEMENTED")>0) then 
Response.Write "受控端版本太旧了，不支持自动还原，请您先升级受控端。" 
Response.End 
end if 
Response.Write returnstr&"服务器:"&dsserver("ip")&" 2分钟后开始执行。一般20G的数据需要半小时来运行。<br>"

elseif Request("Submit")="马上重置整个用户数据目录的权限到初始状态" then

returnstr =  BUILDALLACL(URL,FreeHostsharekey,var)
if (instr(1,returnstr,"NOT IMPLEMENTED")>0) then 
Response.Write "受控端版本太旧了，不支持自动还原，请您先升级受控端。" 
Response.End 
end if 
Response.Write returnstr&"服务器:"&dsserver("ip")&" 2分钟后开始执行。一般30G的数据需要半小时来运行。<br>"

elseif Request("Submit")="马上重新设置所有用户的配额上限" then

Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Host where ServerlistID='"&dsserver("id")&"'"
	dsph.Open Sql,conn,1,3
while Not dsph.Eof

Set dshost = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_HostProductlist where Hosttype='"&dsph ("Hosttype")&"'"
	dshost.Open Sql,conn,1,1
if Not dshost.Eof then

username=dsph("ftpname")
spacelimit=dshost ("spacelimt")
if not isnull(dsph("spacelimt")) then  spacelimit=dsph("spacelimt")

returnstr =ModifyUser2(URL,FreeHostsharekey,username,comment,homedir,spacelimit,starttime,endtime,type1,type2,type3,email,host,hostcomment,MaxConnections,EnumAppsInPool,DefaultDoc,ScriptMaps,AccessFlags,LogFileDirectory,HttpErrors,MaxBandwidth)

Response.Write returnstr&"<br>"
response.flush

End If
dshost.close
dsph.movenext
wend

end If

dsserver.movenext
wend
%>

<%
'if Request("Submit")="马上重新计算所有用户的配额" then
'注意，下面的信息只是在2006-11-28日前的受控端才要手工处理：<br><br>
'将以下内容复制到记录本中，另存成rebulid.bat，将这个文件上传到服务器中，双击运行它，就可以还原配额。
'while not dsph.eof
'username=dsph ("Ftpname")
'homedir=dsserver("homedir")
'homedir=replace(homedir&"\"&username,"\\","\")
'rbsone="rbs.exe -r -v "&username&" "&homedir&"\"&"*.*"
'rbsone=replace(rbsone,"\\","")
'rbs=rbs+"</br>"+rbsone

'dsph.movenext
'wend
'dsph.close
'set dsph=nothing
'end if
%>

<br><br>


<br><br></div>
</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%>
