<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
gotodir=Request.QueryString ("gotodir")

tempstr=lcase(replace(gotodir,"\",""))
if tempstr<>"" then
tempstrend=right(tempstr,4)
tempstrend2=right(tempstr,3)
if tempstrend<>".jpg" and  tempstrend<>".gif" and tempstrend<>".swf" and  tempstrend<>".htm" and  tempstrend<>"html" and  tempstrend<>".css" and  tempstrend<>".doc" and  tempstrend2<>".js" then
	ef=True
	ec="文件类型只能是.jpg,.gif,.swf,.htm,.css,.doc,.js,.html格式！"
ElseIf  Instr(tempstr,"..")>0 Or Instr(tempstr,"\")>0 Or Instr(tempstr,"/")>0 Then
	ef=True
	ec="文件名不能有特殊字符！"&tempstr
end If
tempstrstart=left(tempstr,len(tempstr)-4)
end if

If session("agentusername")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
elseif not Application("canagnimg")=true then
	ef=True
	ec="管理员设置不允许上传图片。"
elseIf RegExpTest("[^A-Za-z0-9--_]",tempstrstart) Then
	ef=True
	ec="文件名有非法字符！"
end if
if not ef then
memuser=session("agentusername")
root=Application("agnimgpath")&"\"&memuser
curdir=root&gotodir
httpcur=Application("roothttp")&memuser&replace(gotodir,"\","/")
'Response.Write curdir
if memuser="" or Instr(1,curdir,"..", 1)>0 or Instr(1,curdir,"+", 1)>0 or Instr(1,curdir,"%", 1)>0 or Instr(1,curdir," ", 1)>0 then  Response.Redirect "/e.asp?ec=目录授权出错！"
    Set fso = CreateObject("Scripting.FileSystemObject")
    if not fso.FileExists(curdir) then Response.Redirect "../e.asp?e=此目录不存在或被删除了！"
    fso.DeleteFile(curdir)
    set fso = nothing
    
Response.Redirect Request.ServerVariables("HTTP_REFERER")
    
end if
if ef then
Response.Redirect "../e.asp?e="&ec
end if%>

