Batch modification of RAR file comments in PHP code

  • 2020-03-31 21:18:44
  • OfStack

We open the help file of WINRAR, the help file mentioned in the command line mode to modify the RAR file comment and add the two parameters of the compressed document are A\C,WINRAR's description file is as follows:
Add all *.hlp files from the current folder to the zip file help.rar

WinRAR a help *. HLP

Comments can be added from the file using -z< Document > The switch.
WinRAR c - zinfo. TXT dummy

In this way, we can call CMD through PHP and run the above two WINRAR parameters to modify the comments of RAR files and add compressed package files in batches.

The following code is how I read out the file path from my database and finally implemented the batch modification of the RAR file annotation. Since the database is ACCESS, I created a new ODBC source. At the same time, both RAR. Exe and cmd.exe are in the same directory as 1.php
 
<? 
$id=$_GET[id]; 
if($id=="") 
{ 
echo " Parameter error "; 
exit; 
} 
if($id>=400) 
{ 
echo " All over "; 
exit; 
} 
$db=odbc_connect("dw","",""); 
$sql="select * from 'download' where 'id'=$id"; 
$query=odbc_exec($db,$sql); 
$filename=odbc_result($query,2); 
if($filename=="") 
{ 

} 
$filename=str_replace("#1 " ,"",$filename); 
$filename=str_replace("#2 " ,"",$filename); 
$filename="soft/".$filename; 
echo $filename."<br>"; 
if(!file_exists($filename)) 
{ 
echo " File does not exist , Let's go to the next one ID"; 
$id++; 
echo "<META HTTP-EQUIV='Refresh' 

CONTENT='0;URL=../test/1.php?id=$id'>"; 
exit; 
}//Read out the file name and check to see if the file exists
else 
{ 
'WinRAR a $filename  Directions for use .txt'; 
echo " Insert instruction file successfully "; 
$id++; 
echo "<META HTTP-EQUIV='Refresh' CONTENT='0;URL=../test/1.php?id=$id'>"; 
} 
odbc_close($db); 
?> 


X x x x x x x x x x x x x x x x x x x x
Recently, the collection of popular, many friends may be trying to build a rich content through the collection of data to complete the site.
At some point, however, the RAR files we normally collect are commented in bulk, and putting them on your own site is like advertising for someone else.
Recently I also encountered such a problem, for this great trouble, and then carefully looking through the WINRAR help file found that we can through the following method to achieve batch modification.
We open the help file of WINRAR, the help file mentioned in the command line mode to modify the RAR file comment and add the two parameters of the compressed document are A\C,WINRAR's description file is as follows:
Add all *.hlp files from the current folder to the zip file help.rar
WinRAR a help *. HLP

Comments can be added from the file using -z< Document > The switch.
WinRAR c - zinfo. TXT dummy

In this way, we can call CMD through PHP and run the above two WINRAR parameters to modify the comments of RAR files and add compressed package files in batches.

The following code is how I read out the file path from my database and finally implemented the batch modification of the RAR file annotation. Since the database is ACCESS, I created a new ODBC source.RAR.EXE and cmd.exe are in the same directory as 1.php
 

<? 
$id=$_GET[id]; 
if($id=="") 
{ 
echo " Parameter error "; 
exit; 
} 
if($id>=400) 
{ 
echo " All over "; 
exit; 
} 
$db=odbc_connect("dw","",""); 
$sql="select * from 'download' where 'id'=$id"; 
$query=odbc_exec($db,$sql); 
$filename=odbc_result($query,2); 
if($filename=="") 
{ 
} 
$filename=str_replace("#1 " ,"",$filename); 
$filename=str_replace("#2 " ,"",$filename); 
$filename="soft/".$filename; 
echo $filename."<br>"; 
if(!file_exists($filename)) 
{ 
echo " File does not exist , Let's go to the next one ID"; 
$id++; 
echo "<META HTTP-EQUIV='Refresh' 

CONTENT='0;URL=../test/1.php?id=$id'>"; 
exit; 
}//Read out the file name and check to see if the file exists
else 
{ 
'WinRAR a $filename  Directions for use .txt'; 
echo " Insert instruction file successfully "; 
$id++; 
echo "<META HTTP-EQUIV='Refresh' CONTENT='0;URL=../test/1.php?id=$id'>"; 
} 
odbc_close($db); 
?> 

Related articles: