View file xj9/gzip.php

File size: 2.35Kb
<?
##################################################################################################
##	                Script name  :  In4at                                                       ##
##	                    Version  :  Final                                                       ##
##                      Made by  :  XPYCT(?????? ???????)                                       ##
##	                     E-mail  :  bce-ok@bk.ru	                                            ##
##                          ICQ  :  447-50-50-62                                                ##
##                         Site  :  http://vkontakte.ru/id31604521                              ##
## ????????! ?????? ???????????????? ?????????! ??????????? W4at by XPYCT                       ##
##################################################################################################
if($_SERVER['HTTP_ACCEPT_ENCODING']){
$compress = strtolower($_SERVER['HTTP_ACCEPT_ENCODING']);
}else{
$compress = strtolower($_SERVER['HTTP_TE']);}
if(substr_count($compress,'deflate')){
function compress_output_deflate($output){
return gzdeflate($output,4);}
$method = 'deflate';
header('Content-Encoding: deflate');
ob_start('compress_output_deflate');
ob_implicit_flush(0);}else if(substr_count($compress,'gzip')) {
function compress_output_gzip($output){ 
return gzencode($output,4);}
$method = 'gzip';
header('Content-Encoding: gzip');
ob_start('compress_output_gzip');
ob_implicit_flush(0);}else if(substr_count($compress,'x-gzip')){
function compress_output_x_gzip($output){
$x = "\x1f\x8b\x08\x00\x00\x00\x00\x00";
$size = strlen($output);
$crc = crc32($output);
$output = gzcompress($output,4);
$output = substr($output, 0, strlen($output) - 4);
$x.= $output;
$x.= pack('V',$crc);
$x.= pack('V',$size);
return $x;}
$method = 'x-gzip';
header('Content-Encoding: x-gzip');
ob_start('compress_output_x_gzip');
ob_implicit_flush(0);}
function info_compress(){
global $method,$compress;
if($method){$contents = ob_get_contents();
$in = strlen($contents);
if($method == 'deflate'){
$out = strlen(gzdeflate($contents,4));}
else if($method == 'gzip'){
$out = strlen(gzencode($contents,4));}
else if($method == 'x-gzip'){
$out = strlen(gzcompress($contents,4));}
$percent = round(100-(100/($in/$out)),1);
print '[Gzip '.$percent.'%]';}else{
print '[Gzip off]';}}
?>