先上一個完整代碼
<!--Name -ASP在線解壓,壓縮工具 copyright -錯新站長站(www.49028c.com)--><%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%><title>歡迎使用ASP在線解壓,壓縮工具</title><body><TABLE border=0 width=80% align=center cellspacing=1 cellpadding=3 style="FONT-FAMILY: Verdana;font-size:14px;BORDER: #000000 1px solid;background-color:#f7f7f7"><tr><th width="100%" height="24" bgcolor="#33CCFF"> </th></tr><tr><td bgcolor="#33CCFF"><%Server.ScriptTimeout=99999Dim winrar,cmddirWinrar="C:/Program Files/WinRAR/Winrar.exe" '壓縮文件(Winrar)的地址cmddir="%windir%/system32/cmd.exe" 'cmd.exe(命令提示符)的地址user="csisp" '本程序的用戶名pwd="csisp" '本程序的登陸、壓縮、解壓縮密碼,請大家務必修改(至少8位以上的組合密碼才夠安全!)if request.Form("user")=user and request.Form("pwd")=pwd thenresponse.write "本文件夾路徑:"&Server.Mappath(".")&"<br>"from=request.Form("from")where=request.Form("where")if from<>"" and where<>"" then Dim a,b,Shell,Runing,Runcode,Cmd if instr(where,":")=0 then a=Server.mappath(""&where&"") else a=where if instr(from,":")=0 then b=Server.mappath(""&from&"") else b=from 'response.Write b if right(b,1)<>"/" and left(right(b,4),1)<>"." then b=b&".rar" On Error Resume Next Set Shell = Server.CreateObject("WScript.Shell") if request.QueryString("action")=1 then '解壓縮 if not ReportFileStatus(b)then Response.Write("沒有找到 "&b&"可能不存在!"):Response.End() Runing= cmddir&" /c """&winrar&""" x -ibck -t -y -o+ -p"&pwd&" " '設置運行解壓縮的命令。 Cmd=Runing&b&" "&a&"/" elseif request.QueryString("action")=0 then '壓縮文件 if (not ReportFileStatus(a)) and (not ReportFolderStatus(a)) then Response.Write("沒有找到 "&a&"可能不存在!"):Response.End() Cmd= cmddir&" /c del /f /q "&b Runcode = Shell.Run(Cmd,1,True) Runing= cmddir&" /c """&winrar&""" a -ibck -y -ep -o+ -p"&pwd&" " '壓縮。 Cmd=Runing&b&" "&a else '刪除文件 Cmd= cmddir&" /c del /f /q "&b end if Runcode = Shell.Run(Cmd,1,True) Runing = Shell.Run(cmddir&" /c taskkill /im winrar.exe",1,false) Runing = Shell.Run(cmddir&" /c exit",1,false) Set Shell=nothing ErrInfo%> <%else%><form name="frm" method="post" action="?action=1" style="BORDER: #d9d9d9 1px solid;background-color:#f7f7f7">--------------------------------------<strong>解壓縮文件</strong>---------------------------------------<br><br>請輸入rar壓縮文件地址:<input name="from" value="1.rar" size="50"><br>解壓到:<input name="where" value="." size="50">文件夾請使用絕對路徑且在最后加 "/" <br><br><input name="submit" type="submit" value=" 解 壓 "><input type="hidden" name="user" value="<%=request.Form("user")%>"><input type="hidden" name="pwd" value="<%=request.Form("pwd")%>"></FORM><form name="frm" method="post" action="?action=0" style="BORDER: #d9d9d9 1px solid;background-color:#f7f7f7">--------------------------------------<strong>壓縮文件</strong>---------------------------------------<br><br>請在此輸入您要壓縮文件地址:<input name="where" value="./data/dvbbs7#.mdb" size="50">您也可以輸入文件夾<br><br>存放路徑及新文件名:<input name="from" value="../data/1.rar" size="50">自動覆蓋同名文件<br><br><input name="submit" type="submit" value=" 壓 縮 "><input type="hidden" name="user" value="<%=request.Form("user")%>"><input type="hidden" name="pwd" value="<%=request.Form("pwd")%>"></FORM><%ErrInfoend ifelselogin()end ifSub ErrInfo if not isempty(Runcode) and Runcode=0 Then Response.Write("操作成功執行,您提交的操作如下:<br>"& Cmd) elseif not isempty(Runcode) then Response.Write("操作執行失?。】赡苣臋嘞薏粔蚧蛘咴摮绦驘o法在DOS(命令提示符)下運行,您提交的操作如下:<br>" & Cmd) else end if If Err Then Response.Write "<br>"&err.description err.Clear End If%><form name="frm" method="post" action="?action=2" style="BORDER: #d9d9d9 1px solid;background-color:#f7f7f7">--------------------------------------<strong>刪除文件</strong>---------------------------------------<br><br>請輸入要刪除文件地址:<input name="from" size="50" value=<%=from%>>文件夾請使用絕對路徑且在最后加“/” <br><input type="hidden" name="where" value=<%if where<>"" then response.Write where else response.Write "."%>><br><input name="submit" type="submit" value=" 刪 除 "><input type="hidden" name="user" value="<%=request.Form("user")%>"><input type="hidden" name="pwd" value="<%=request.Form("pwd")%>"></FORM><br><%End SubFunction ReportFileStatus(filespec) Dim fso Set fso = CreateObject("Scripting.FileSystemObject") ReportFileStatus=false If (fso.FileExists(filespec)) Then ReportFileStatus = true Set fso =nothingEnd FunctionFunction ReportFolderStatus(fldr) Dim fso Set fso = CreateObject("Scripting.FileSystemObject") ReportFolderStatus=false If (fso.FolderExists(fldr)) Then ReportFolderStatus = true Set fso =nothingEnd FunctionSub login()%><form name="frm" method="post" action="?action=2" style="BORDER: #d9d9d9 1px solid;background-color:#f7f7f7"> <p>--------------------------------------<strong>登陸系統</strong>---------------------------------------<br> <br>用戶名:<input name="user" value="csisp"> </p>密 碼: <input name="pwd" type="password" id="pwd"> <br> <br> <input name="submit" type="submit" value=" 登陸 "></FORM><%End sub%></td></tr><tr> <td height="22" align="center" bgcolor="#FFFFFF"> Copyright ©2008 <a href="http://www.49028c.com">錯新站長站</a></td></tr></table></body>
新聞熱點
疑難解答