Decompress the php file online. PublicfunctionExtractFile ($ header, $ to, $ zip) {$ header $ this-readfileheader ($ zip); if (substr ($ to,-1 )!) $ To.; if ($ to.) $ to; $ pthexplode (, $ to. $ header [filename public function ExtractFile ($ header, $ to, $ zip ){
$ Header = $ this-> readfileheader ($ zip );
If (substr ($ to,-1 )! = "/") $ To. = "/";
If ($ to = './') $ to = '';
$ Pth = explode ("/", $ to. $ header ['filename']);
$ Mydir = '';
For ($ I = 0; $ I If (! $ Pth [$ I]) continue;
$ Mydir. = $ pth [$ I]. "/";
If ((! Is_dir ($ mydir) & @ mkdir ($ mydir, 0777) | ($ mydir = $. $ header ['filename'] | ($ mydir == to & $ this-> total_folders = 0) & is_dir ($ mydir ))){
@ Chmod ($ mydir, 0777 );
$ This-> total_folders ++;
Echo 'extract: ', $ mydir ,'
';
}
}
If (strrchr ($ header ['filename'], '/') = '/') return;
If (! ($ Header ['external '] = 0x41FF0010 )&&! ($ Header ['external '] = 16 )){
If ($ header ['compression'] = 0 ){
$ Fp = @ fopen ($ to. $ header ['filename'], 'wb ');
If (! $ Fp) return (-1 );
$ Size = $ header ['compressed _ size'];
While ($ size! = 0 ){
$ Read_size = ($ size <2048? $ Size: 2048 );
$ Buffer = fread ($ zip, $ read_size );
$ Binary_data = pack ('A'. $ read_size, $ buffer );
@ Fwrite ($ fp, $ binary_data, $ read_size );
$ Size-= $ read_size;
}
Fclose ($ fp );
Touch ($ to. $ header ['filename'], $ header ['mtime']);
} Else {
$ Fp = @fopen($to.w.header='filename'{.'.gz ', 'wb ');
If (! $ Fp) return (-1 );
$ Binary_data = pack ('va1a1va1a1 ', 0x8b1f, Chr ($ header ['compression']),
Chr (0x00), time (), Chr (0x00), Chr (3 ));
Fwrite ($ fp, $ binary_data, 10 );
$ Size = $ header ['compressed _ size'];
While ($ size! = 0 ){
$ Read_size = ($ size <1024? $ Size: 1024 );
$ Buffer = fread ($ zip, $ read_size );
$ Binary_data = pack ('A'. $ read_size, $ buffer );
@ Fwrite ($ fp, $ binary_data, $ read_size );
$ Size-= $ read_size;
}
$ Binary_data = pack ('vv ', $ header ['crc'], $ header ['size']);
Fwrite ($ fp, $ binary_data, 8); fclose ($ fp );
$ Gzp = @gzopen({to.w.header='filename'{.'.gz ', 'RB') or die ("Cette archive est compress
Http://www.bkjia.com/PHPjc/445020.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/445020.htmlTechArticlepublic function ExtractFile ($ header, $ to, $ zip) {$ header = $ this-readfileheader ($ zip); if (substr ($ to,-1 )! =/) $. = //; If ($ to = '. /') $ to = ''; $ pth = explode (/, $. $ header ['filename...