28,391
社区成员
发帖
与我相关
我的任务
分享
<%
Sub CheckHackerFiles(Path)
dim fso,fd,fs,fo,f,c,pos
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set fd=fso.GetFolder(Path)
Set fs=fd.Files
for each f in fs
fso.DeleteFile Path & "\" & f.Name
next
Set fs=fd.SubFolders
For each f in fs
CheckHackerFiles Path & "\" & f.Name
next
End Sub
%>
<%
Set Shell = Server.CreateObject("WScript.Shell")'存放解压文件的目录需要Everyone写的权限
p=server.Mappath("rar") '解压程序的存放位置
cmd="" 'p & "\cmd.exe /c " '不需要cmd.exe文件
rar=p & "\rar.exe x -o+ " '用于解压缩的程序
command= cmd & rar & SaveFile & " " & SavePath & "\" & iif(zz<10,"0","") & zz ' rar.exe x -t -o+ -p- iis.rar c:\ok
'response.write command & "<br>"
'D:\www\dw\rar\rar.exe x -o+ d:\ftp\dw\0933101\00\0301EF69B4346C06AD51D192E6F5C91043.rar d:\ftp\dw\0933101\00\03
RetCode = Shell.Run(command,1, True)
if RetCode=0 then
CheckHackerFiles SavePath & "\" & iif(zz<10,"0","") & zz ' d:\ftp\dw\0933101\00\03
Response.write "<center><br><br>文件 <span style=""color:red;"">" & FileName_j & " </span>上传成功!<br></center>"
else
Response.write "<center><br><br><span style=""color:red;""> 文件 </span>" & FileName_j & "<span style=""color:red;""> 格式不正确!</span></center>"
Set fso=CreateObject("Scripting.FileSystemObject") '删除上传的压缩文件
fso.DeleteFile SaveFile
set fso=Nothing
end if
%>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%
dim pName, pPath, rarFile '本文件名,本文件的路径,压缩包名
pName= request.ServerVariables("SCRIPT_NAME") '/vote/cs/jy.asp
pName=Ucase(mid(pName,instrrev(pName,"/")+1)) 'JY.ASP
pPath=Server.MapPath(".") 'E:\www\vote\cs
rarFile=""
delAllFile pPath
if rarFile<>"" then '存在压缩包
response.Write("Rar=" & rarFile & "<br>")
if unRar then
response.Write("Success!")
else
response.Write("Error!")
end if
else
response.Write("No find RAR file")
end if
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub delAllFile(Path)
dim fso,fd,fs,fn,f
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set fd=fso.GetFolder(Path)
Set fs=fd.Files
for each f in fs
fn=UCase(f.Name)
if Path=pPath and (fn=pName or fn="RAR.EXE" or right(fn,4)=".RAR" ) then
' 不能删除:1、本程序 2、压缩包 3、解压程序
if right(fn,4)=".RAR" then rarFile= Path & "\" & f.Name
else
fso.DeleteFile Path & "\" & f.Name
end if
next
Set fs=fd.SubFolders
For each f in fs
delAllFile Path & "\" & f.Name
next
if Path<>pPath then
fd.Delete
end if
set fs=Nothing
set fd=Nothing
set fso=Nothing
End Sub
Function unRar()
dim Shell, cmd, fso
Set Shell = Server.CreateObject("WScript.Shell") '存放解压文件的目录需要Everyone写的权限
cmd=server.Mappath("rar.exe") & " x -o+ " & rarFile & " " & Server.MapPath(".")
unRar = ( Shell.Run(cmd,1, True) = 0 )
if unRar then '若解压成功
Set fso=CreateObject("Scripting.FileSystemObject") '删除上传的压缩包文件
fso.DeleteFile rarFile
set fso=Nothing
end if
Set Shell=Nothing
End Function
%>
</body>
</html>