<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunction.asp"-->
<%
If session("HOSTAUID")="" 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_Host where id='"&session("HOSTAUID")&"'"
			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="不存在的虚拟主机ID！"
end if
end if


If not ef then
if dsph("status")="暂停" or dsph("status")="停止" 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='"&dsph ("ServerlistID")&"'"
	dsserver.Open Sql,conn,1,1
if dsserver.Eof then
	ef=True
	ec="服务器不存在！"
end if
end if

if not ef then
URL=dsserver("site")
FreeHostsharekey=dsserver("FreeHostsharekey")
username=dsph("ftpname")
returnstr=ShowUser2(URL,FreeHostsharekey,username)
if Not instr(returnstr,"用户名：")>1 then 
Response.Write "这台受控服务器自检没有通过，请在站点管理，虚拟主机中自检来分析原因。"
Response.End 
end if 

webpath=replace(dsserver("homedir") &"\"&dsph("ftpname")&"\web\","\\","\")
'Response.Write webpath
'Response.Write returnstr

If Request.Form ("Submit")="马上修改400页" and instr(returnstr,"\inetpub\custerr")>1 then'7
response.write "windows 2008的受控端不支持此项设置"
response.end
End If

HttpErrors=GETvalue(returnstr,";自定义出错信息：",";用户描述为：")

If instr(returnstr,"\inetpub\custerr")>1 then'7
HttpErrors500=GETvalue(HttpErrors,"500,","501,")
HttpErrors500="500,"&HttpErrors500
iisver=7
Else
iisver=6
End If


'404,*,URL,/404.htm
If Request.Form ("Submit")="马上修改404页" Then


if instr(returnstr,":\WINDOWS\help\iisHelp\")>1 then'6
'404,*,FILE,C:\WINNT\help\iisHelp\common\404b.htm|405
on error resume next
HttpErrors404=GETvalue(returnstr,"404,*,","|404,2")
if HttpErrors404="" then
HttpErrors404=GETvalue(returnstr,"404,*,","|405")
end if
else
HttpErrors404=GETvalue(returnstr,"404,*,","|405")
end if
If Request.Form ("err404")="y" Then

if instr(returnstr,":\WINDOWS\help\iisHelp\")>1 then'6
oriHttpErrors404="FILE,C:\WINDOWS\help\iisHelp\common\404b.htm"
else'5
oriHttpErrors404="FILE,C:\WINNT\help\iisHelp\common\404b.htm"
end If

if instr(returnstr,"\inetpub\custerr")>1 then'7
oriHttpErrors404="FILE,c:\inetpub\custerr\zh-CN\404.htm"
End if

HttpErrors=replace(HttpErrors,HttpErrors404,oriHttpErrors404)

else
'HttpErrors=replace(HttpErrors,HttpErrors404,homedir&"URL,/404.htm")
If Request.Form ("err404")="asp" Then HttpErrors=replace(HttpErrors,HttpErrors404,homedir&"FILE,"&webpath&"404.asp")
If Request.Form ("err404")="aspx" Then HttpErrors=replace(HttpErrors,HttpErrors404,homedir&"FILE,"&webpath&"404.aspx")
If Request.Form ("err404")="php" Then HttpErrors=replace(HttpErrors,HttpErrors404,homedir&"FILE,"&webpath&"404.php")
If Request.Form ("err404")="htm" Then HttpErrors=replace(HttpErrors,HttpErrors404,homedir&"FILE,"&webpath&"404.htm")

end if

end if'end 404


'500,*,URL,/404.htm
'自定义出错信息：401,*,FILE,G:\inetpub\custerr\zh-CN\401.htm|403,*,FILE,G:\inetpub\custerr\zh-CN\403.htm|404,*,FILE,?ystemDrive?inetpub\custerr\\404.htm|405,*,FILE,G:\inetpub\custerr\zh-CN\405.htm|406,*,FILE,G:\inetpub\custerr\zh-CN\406.htm|412,*,FILE,G:\inetpub\custerr\zh-CN\412.htm|500,*,FILE,G:\inetpub\custerr\zh-CN\500.htm|501,*,FILE,G:\inetpub\custerr\zh-CN\501.htm|502,*,FILE,G:\inetpub\custerr\zh-CN\502.htm|;用户描述为：FHA:子目录绑定,FHB:,FHC:,FHD:2008/4/5 11:41:03,FHE:2009/4/5 11:41:03,FHF:子目录绑定,FHG:MainHostbyFreeHost,FHH:,FHI:test;FreeHostEnd

'2012
'401,*,FILE,E:\inetpub\custerr\zh-CN\401.htm|403,*,FILE,E:\inetpub\custerr\zh-CN\403.htm|404,*,FILE,E:\inetpub\custerr\zh-CN\404.htm|405,*,FILE,E:\inetpub\custerr\zh-CN\405.htm|406,*,FILE,E:\inetpub\custerr\zh-CN\406.htm|412,*,FILE,E:\inetpub\custerr\zh-CN\412.htm|500,*,FILE,E:\inetpub\custerr\zh-CN\500.htm|501,*,FILE,E:\inetpub\custerr\zh-CN\501.htm|502,*,FILE,E:\inetpub\custerr\zh-CN\502.htm|

If Request.Form ("Submit")="马上修改500页" Then
If Request.Form ("err500")<>"y" Then

If iisver=6 Then
HttpErrors=replace(HttpErrors,"415.htm|500,*,URL,/500.asp|","415.htm|")
HttpErrors=replace(HttpErrors,"415.htm|500,*,URL,/500.aspx|","415.htm|")
HttpErrors=replace(HttpErrors,"415.htm|500,*,URL,/500.php|","415.htm|")
HttpErrors=replace(HttpErrors,"415.htm|500,*,URL,/500.htm|","415.htm|")
if Request.Form ("err500")="asp" then HttpErrors=replace(HttpErrors,"415.htm|","415.htm|500,*,FILE,"&webpath&"500.asp|")
if Request.Form ("err500")="aspx" then HttpErrors=replace(HttpErrors,"415.htm|","415.htm|500,*,FILE,"&webpath&"500.aspx|")
if Request.Form ("err500")="php" then HttpErrors=replace(HttpErrors,"415.htm|","415.htm|500,*,FILE,"&webpath&"500.php|")
if Request.Form ("err500")="htm" then HttpErrors=replace(HttpErrors,"415.htm|","415.htm|500,*,FILE,"&webpath&"500.htm|")
End if

If iisver>6 then
If Request.Form ("err500")="asp" Then HttpErrors=replace(HttpErrors,HttpErrors500,"500,*,FILE,"&webpath&"500.asp|")
If Request.Form ("err500")="aspx" Then HttpErrors=replace(HttpErrors,HttpErrors500,"500,*,FILE,"&webpath&"500.aspx|")
If Request.Form ("err500")="php" Then HttpErrors=replace(HttpErrors,HttpErrors500,"500,*,FILE,"&webpath&"500.php|")
If Request.Form ("err500")="htm" Then HttpErrors=replace(HttpErrors,HttpErrors500,"500,*,FILE,"&webpath&"500.htm|")
End if

Else

'412,*,FILE,G:\inetpub\custerr\zh-CN\412.htm|500,*,FILE,G:\inetpub\custerr\zh-CN\500.htm|501,*,FILE,G:\inetpub\custerr\zh-CN\501.htm|

HttpErrors=replace(HttpErrors,"415.htm|500,*,URL,/500.asp|","415.htm|")
HttpErrors=replace(HttpErrors,"415.htm|500,*,URL,/500.aspx|","415.htm|")
HttpErrors=replace(HttpErrors,"415.htm|500,*,URL,/500.php|","415.htm|")
HttpErrors=replace(HttpErrors,"415.htm|500,*,URL,/500.htm|","415.htm|")

If iisver>6 Then
HttpErrors=replace(HttpErrors,HttpErrors500,"500,*,FILE,C:\inetpub\custerr\zh-CN\500.htm|")
End if


end if
end if'end 500


'400,*,URL,/400.htm
If Request.Form ("Submit")="马上修改400页" Then
HttpErrors404=GETvalue(returnstr,"自定义出错信息：","|401,")
If Request.Form ("err400")<>"y" Then
If Request.Form ("err400")="asp" Then HttpErrors=replace(HttpErrors,HttpErrors404,"400,*,FILE,"&webpath&"400.asp")
If Request.Form ("err400")="aspx" Then HttpErrors=replace(HttpErrors,HttpErrors404,"400,*,FILE,"&webpath&"400.aspx")
If Request.Form ("err400")="php" Then HttpErrors=replace(HttpErrors,HttpErrors404,"400,*,FILE,"&webpath&"400.php")
If Request.Form ("err400")="htm" Then HttpErrors=replace(HttpErrors,HttpErrors404,"400,*,FILE,"&webpath&"400.htm")
else
if instr(returnstr,":\WINDOWS\help\iisHelp\")>1 then'6
oriHttpErrors404="400,*,FILE,C:\WINDOWS\help\iisHelp\common\400.htm"
else'5
oriHttpErrors404="400,*,FILE,C:\WINNT\help\iisHelp\common\404b.htm"
end If

HttpErrors=replace(HttpErrors,"400,*,URL,/400.asp",oriHttpErrors404)
HttpErrors=replace(HttpErrors,"400,*,URL,/400.aspx",oriHttpErrors404)
HttpErrors=replace(HttpErrors,"400,*,URL,/400.php",oriHttpErrors404)
HttpErrors=replace(HttpErrors,"400,*,URL,/400.htm",oriHttpErrors404)


end if
end if'end 400


%>
<!--#include virtual="/inc-freehost-function/template-hostadm-top.asp"-->
 　修改默认出错页
 
<%

'Response.write oriHttpErrors404
'Response.write "<br><br>--------------<br>"
'Response.write HttpErrors
'Response.End

'调用开通function
homedir=""
temp=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 oriHttpErrors404

dsph.update
dsph.close

%>
<br>
<br>
<br>
默认出错页已成功更改!
<!--#include virtual="/inc-freehost-function/template-hostadm-end.asp"-->
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>