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

serverlistid=0 '需要重建的服务器编号---只对Imail有效
server.ScriptTimeout =2400
If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
elseIf session("canadmemailset")="" Then
	ef=True
	ec="您没有此操作的权限。"
end if

if not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Email where ServerlistID = '"&serverlistid&"' order by id desc"
	if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
	dsph.Open Sql,conn,1,3
if dsph.Eof then
	ef=True
	ec="此类邮箱不存在！"
end if
end if


if not ef then
	Set dshost = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_EmailProductlist where Emailtype='"&dsph ("Emailtype")&"'"
	dshost.Open Sql,conn,1,1
if dshost.Eof then
	ef=True
	ec="产品类型不存在！"
end if
end if

if not ef then
	Set dsserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_ServerEmaillist where id='"&dsph ("ServerlistID")&"'"
	dsserver.Open Sql,conn,1,1
if dsserver.Eof then
	ef=True
	ec="服务器不存在！"
end if
end if

'if not ef then
'Set dspdallemail = Server.CreateObject("ADODB.Recordset")
'		Sql="Select * from FreeHost.FreeHost_Product_ALLEmail where PdEID<>'"&dsph ("id")&"' and emailname like '%@"&domain&"'"
'		dspdallemail.Open Sql,conn,1,1
'if not dspdallemail.Eof then
'	ef=True
'	ec="此域已被使用！已存在的域管理员："&dspdallemail("emailname")&" 但要绑定："&domain
'end if
'end if
if not ef then
While Not dsph.eof
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
Set dspdallemail = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Product_ALLEmail where PdEID='"&dsph ("id")&"'"
		dspdallemail.Open Sql,conn,3,2
if not dspdallemail.Eof Then
email=trim(dspdallemail("emailname"))
emailname=trim(dspdallemail("emailname"))
emailarry=split(email,"@")
name1=emailarry(0)
domain=emailarry(1)
temA=SetAdmEmail(dsph ("ServerlistID"),emailname,domain,dsph ("emailcount"),dsph ("domainspacelimt")*1024)'maxuser

if dsserver("softtype")="Imail" then
URL=dsserver("site")
FreeHostsharekey=dsserver("FreeHostsharekey")
regpath=domain&"\users\"&emailname
key="MaxSize"
keyvalue=dshost ("userspacelimt")*1024*1024
retvlue=replace(Regimailop(URL,FreeHostsharekey,regpath,key,keyvalue,2),"操作成功，数值为：","")
end If

temB=ChpassEmail(dsph ("ServerlistID"),name1,domain,dspdallemail("emailpass"))

End If
dspdallemail.close

'tem2=ModAdmEmail(dsph ("ServerlistID"),trim(dspdallemail("emailname")),domain,dsph ("emailcount"),dsph ("domainspacelimt")*1024)'maxuser
'dim websize
'websize=dspdl ("userspacelimt")*1024
'tem=ChpassEmail(dsph ("ServerlistID"),name1,domain,Request.Form ("password"))

dsph.movenext
wend

%>
<!--#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="90" align="center" valign="middle" background="img/r3.jpg" id="tableTop1" style="Cursor:hand"><a href="admemail.asp"><font color="#FFFFFF"><strong>邮箱管理</strong></font></a></td>
            <td width="5" background="img/midtop2.gif">&nbsp;</td>
          </tr>
      </table></TD>
      <TD width="83">&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">
	  
	  <DIV class="tableborder" id="t4"><br><%=temA%><%=retvlue%><%=temB%>
<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%>
