当前位置:首页 > ASP教程 > ASP其他

asp目录读写权限检测脚本 TestFolder

效果图:

asp目录读写权限检测脚本 TestFolder - 文章图片
代码如下:

<BR /><% <BR />'Response.Buffer = FALSE <BR />Server.ScriptTimeOut=999999999 <BR />Set Fso=server.createobject("scr"&"ipt"&"ing"&"."&"fil"&"esy"&"ste"&"mob"&"jec"&"t") <BR />%> <BR /><% <BR />sPath=replace(request("sPath"),"/","") <BR />ShowPath="" <BR />if sPath="" then <BR />ShowPath="C:Program Files" <BR />else <BR />ShowPath=sPath <BR />end if <BR />%> <BR /><form name="form1" method="post" action=""> <BR /><label><br> <BR /></label> <BR /><label> </label> <BR /><table width="80%" border="0"> <BR /><tr> <BR /><td><strong>路径:</strong> <BR /><input name="sPath" type="text" id="sPath" value="<%=ShowPath%>" style="width:500px;height:25px"> <BR /><input style="width:160px;height:28px" type="submit" name="button" id="button" value="提交" /> 可以读 不可读 可以写 不可写</td> <BR /></tr> <BR /></table> <BR /></form> <BR /><% <BR />Dim i1:i1=0 <BR />if sPath<>"" then <BR />Call Bianli(sPath) <BR />end if <BR />Set Fso=nothing <BR />%> <BR /><% <BR />Function CheckDirIsOKWrite(DirStr) <BR />On Error Resume Next <BR />Fso.CreateTextFile(DirStr&"	emp.tmp") <BR />if Err.number<>0 then <BR />Err.Clear() <BR />response.write " <font color=red>不可写</font>" <BR />CheckDirIsOKWrite=0 <BR />else <BR />response.write " <font color=green><b>可以写</b></font>" <BR />CheckDirIsOKWrite=1 <BR />end if <BR />End Function <BR />Function CheckDirIsOKDel(DirStr) <BR />On Error Resume Next <BR />Fso.DeleteFile(DirStr&"	emp.tmp") <BR />if Err.number<>0 then <BR />Err.Clear() <BR />response.write " <font color=red>不可删除</font>" <BR />else <BR />response.write " <font color=green><b>可以删除</b></font>" <BR />end if <BR />End Function <br /><br />Function WriteSpace(NunStr) <BR />for iu=0 to NunStr <BR />response.write " " <BR />next <BR />End Function <br /><br />Function Bianli(path) <BR />On Error Resume Next <BR />i1=i1+1 <BR />Set Objfolder=fso.getfolder(path) <BR />Set Objsubfolders=objfolder.subfolders <BR />dim t1:t1=1 <BR />WriteSpace(i1) <BR />response.write path <BR />SubFCount=Objsubfolders.count <BR />if Err.number<>0 then <BR />SubFCount=-1 <BR />Err.Clear() <BR />end if <BR />if SubFCount>-1 then <BR />response.write " <font color=green>可以读</font>" <BR />else <BR />response.write " <font color=red>不可读</font>" <BR />end if <BR />if SubFCount>-1 then <BR />IsWrite=CheckDirIsOKWrite(path) <BR />if IsWrite=1 then CheckDirIsOKDel(path) <BR />For Each Objsubfolder In Objsubfolders <BR />'response.write "<br>("&t1&"/"&Objsubfolders.count&")/<b>"&i1&"</b> "&vbcrlf <BR />response.write "<br> "&vbcrlf <BR />Nowpath=path + "" + Objsubfolder.name <BR />Set Objfolder=nothing <BR />Set Objsubfolders=nothing <BR />Call Bianli(nowpath)'递归 <BR />i1=i1-1 <BR />t1=t1+1 <BR />Next <BR />end if <BR />End Function <BR />%> <BR /><BR />另外硕编程提供一份源码下载//www.51frw.cn/codes/39929.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!