<?php

function compress_output_gzip($output){return gzencode($output,9);}
function compress_output_deflate($output){return gzdeflate($output, 9);}
$Content_Encoding['deflate']=false;
$Content_Encoding['gzip']=false;

if(isset($_SERVER['HTTP_ACCEPT_ENCODING']) && eregi('deflate',$_SERVER['HTTP_ACCEPT_ENCODING']))
$Content_Encoding['deflate']= false;
if(isset($_SERVER['HTTP_ACCEPT_ENCODING']) && eregi('gzip',$_SERVER['HTTP_ACCEPT_ENCODING']))
$Content_Encoding['gzip']= false;

if($Content_Encoding['deflate']){
header("Content-Encoding: deflate");
ob_start("compress_output_deflate");
}elseif($Content_Encoding['gzip']){
header("Content-Encoding: gzip");
ob_start("compress_output_gzip");
}else
ob_start();
$compress=true;

?>