ASP realizes RAR compression and decompression source code

Source: Internet
Author: User
Tags end rar

ASP implementation of RAR compression and decompression source code, as long as a file may be done, ASP compressed directories or files, extract rar files, delete specific files and other functions. This source code is convenient for everyone to carry out two times development, share out.

Here's the winrar.asp code:
<!--
Name-Ayan Online winrar plugin
Copyright-Northland Medicine Court BBS (www.spubbs.com)
Created-2006/5/17
Author-Ayan: tqsir@hotmail.com qq:12895551
-->
<% @LANGUAGE = "VBSCRIPT" codepage= "936"%>
<title> Welcome to use the online winrar plugin </title>
<body>
<table border=0 width=80% align=center cellspacing=1 cellpadding=3 "style="; BORDER: #000000 1px solid;background-color: #f7f7f7 ">
<tr>
<th width= "100%" height= "bgcolor=" #e4e4e4 "><strong><font color=" #FF0000 "> Ayan online winrar plugin </ Font></strong> Latest update Time 2006.5.17 [<a href= "http://www.spubbs.com/dispbbs.asp?boardid=24&id=19979" target=_blank> support page </a>]
</th>
</tr>
<tr>
<td>
<%
server.scripttimeout=99999
Dim Winrar,cmddir
Winrar= "C:\Program files\winrar\winrar.exe" Winrar.exe path progra~1.
Cmddir= "%windir%\system32\cmd.exe" ' Cmd.exe path
User= "spubbs.com" user name
pwd= "spubbs.com" ' login, compress, decompress password, for security reasons, please set this password strong enough
If request. Form ("user") =user and request. Form ("pwd") =pwd Then
Response.Write "This folder path:" &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 "R" (Right (b,4), 1) <> "." Then b=b& ". rar"
On Error Resume Next
Set Shell = Server.CreateObject ("Wscript.Shell")
If request. QueryString ("Action") =1 then ' decompression
If not Reportfilestatus (b) Then Response.Write (b& "does not exist!") "): Response.End ()
runing= cmddir& "/C" "&winrar&" "X-ibck-t-y-o+-P" &pwd& "" "" Set the command to run the decompression.
cmd=runing&b& "" &a& "\"
ElseIf request. QueryString ("Action") =0 then ' compression
if (not Reportfilestatus (a)) and (not Reportfolderstatus (a)) then Response.Write (a& "does not exist!") "): 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& "" ' Compression.
cmd=runing&b& "" &a
Else ' Delete file
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> Decompression </strong>---------------------------------------
<br>
<br>
Please enter the RAR file address:
<input name= "from" value= "1.rar" size= "M" ><br>
Extract to: <input name= "where" value= "." Size= ">
Folder please use absolute path and add "\" at the end <br>
<br>
<input name= "Submit" type= "Submit" value= "extract ><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> Compressed Files </strong>--------------------------------------- <br>
<br>
Please enter the address to compress the file:
<input name= "where" value= "./data/dvbbs7#.mdb" Size= ">
Folders can also be <br>
<br>
Store path and new file name: <input name= "from" value= ". /data/1.rar "Size=" >
Automatically overwrite files with the same name <br>
<br>
<input name= "Submit" type= "submit" value= "compression" ><input type= "hidden" name= "user" value= "<%=request". Form ("user")%> ">
<input type= "hidden" name= "pwd" value= "<%=request". Form ("pwd")%> "></FORM>
<%
Errinfo
End If
Else
Login ()
End If
Sub Errinfo
If not IsEmpty (RunCode) and runcode=0 Then
Response.Write ("Command executed successfully, you submit the following command:<br>" & CMD)
ElseIf not IsEmpty (RunCode) Then
Response.Write (Command execution failed!) Insufficient permissions or the program cannot run in DOS, you submit the following command:<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> Delete Files </strong>--------------------------------------- <br>
<br>
Please enter the address to delete the file: <input name= "from" size= "value=<%=from%>>"
Folder please use absolute path and add "\" at the end <br>
<input type= "hidden" name= "where" value=<%if where<> "" Then response. Write where else response. Write "." %>>
<br>
<input name= "Submit" type= "submit" value= "Delete" >
<input type= "hidden" name= "user" value= "<%=request". Form ("user")%> ">
<input type= "hidden" name= "pwd" value= "<%=request". Form ("pwd")%> ">
</FORM>
<br>
<%
End Sub
Function Reportfilestatus (filespec)
Dim FSO
Set fso = CreateObject ("Scripting.FileSystemObject")
Reportfilestatus=false
If (FSO). FileExists (filespec)) Then Reportfilestatus = True
Set FSO =nothing
End Function
Function Reportfolderstatus (FLDR)
Dim FSO
Set fso = CreateObject ("Scripting.FileSystemObject")
Reportfolderstatus=false
If (FSO). FolderExists (FLDR)) Then Reportfolderstatus = True
Set FSO =nothing
End Function
Sub Login ()
%>
<form name= "frm" method= "post action=" action=2 "style=" BORDER: #d9d9d9 1px solid;background-color: #f7f7f7 ">
<p>--------------------------------------<strong> Landing System </strong>------------------------------ ---------<br>
<br>
User name:
<input name= "user" value= "spubbs.com" >
</p>
Password
<input name= "pwd" type= "password" id= "pwd" >
<br>
<br>
<input name= "Submit" type= "Submit" value= "Landing" >
</FORM>
<%end sub%>
</td>
</tr>
<tr>
&LT;TD height= align= "center" bgcolor= "#e8e8e8" >powered by: <a href = "mailto:tqsir@hotmail.com" > Ayan </a > <a target=blank href=http://wpa.qq.com/msgrd? v=1&uin=12895551&site=www.spubbs.com Online winrar&menu=yes></a> copyright©2003-2006 <a href= "http://www.spub Bs.com "> Northland Medicine Court bbs</a></td>
</tr>
</table>
</body>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.