<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunction.asp"-->
<%
If session("HOSTAUID")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
ElseIf Request.Form ("id")="" Then
	ef=True
	ec="请输入产品ID！"
ElseIf Instr(1, Request.Form ("id"), "'", 1)>0 then
	ef=True
	ec="非法产品ID！"
ElseIf not IsNumeric(Request.Form ("id"))  Then
	ef=True
	ec="产品ID应该是数字！"
ElseIf Instr(1, Request.Form ("htmdir"), "\", 1)>0 or Instr(1, Request.Form ("htmdir"), "..", 1)>0 then
	ef=True
	ec="只允许设一级目录，不要用\或..符号"
ElseIf RegExpTest("[^A-Za-z0-9]",Request.Form ("htmdir")) Then
	ef=True
	ec="目录名中有非法字符！"
ElseIf Request.Form ("htmdir")="" 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='"&Request.Form ("id")&"'"
			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("allowsubbyid")<> session("HOSTAUID") 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")
homedir=dsserver("homedir") 
IISID=dsph("IISID")
%>
<!--#include virtual="/inc-freehost-function/template-hostadm-top.asp"-->
 　设置执行权限
 
<br>
<br>
<br>
<%
htmdir=replace(homedir&"\"&username&"\web\"&dsph("dirname")&"\"&Request.Form ("htmdir"),"\\","\")
htmdir2=replace(Request.Form ("htmdir"),"\\","\")

if Request.Form ("Submit")="取消此目录执行ASP等权限" then
op=1
Response.Write OPHTMDIRSub(URL,FreeHostsharekey,IISID,htmdir,htmdir2,op)
end if

if Request.Form ("Submit")="恢复此目录的执行权限" then
op=0
Response.Write OPHTMDIRSub(URL,FreeHostsharekey,IISID,htmdir,htmdir2,op)
end if


'dsph.update
dsph.close

%>
<br>
<br>
<br>
　<a href="selfhostmodifysub.asp?id=<%=Request("id")%>"><font color="#000000">[返回]</font></a>
<!--#include virtual="/inc-freehost-function/template-hostadm-end.asp"-->
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>