View file header/header.inc.php

File size: 4Kb
<?php
$PREFER_DEFLATE=true;
$FORCE_COMPRESSION=false;

function head_return_replaced_str($o)
{
   $o=ereg_replace("<:([^\:>]*):>","",$o);
   $o=str_replace('href=""','href="'.$_SERVER['SCRIPT_NAME'].'"',$o);
   $o=str_replace('action=""','action="'.$_SERVER['SCRIPT_NAME'].'"',$o);
   $o=str_replace('href="?','href="'.$_SERVER['SCRIPT_NAME'].'?',$o);
   $o=str_replace('action="?','action="'.$_SERVER['SCRIPT_NAME'].'?',$o);
   $o=str_replace('URL=?','URL='.$_SERVER['SCRIPT_NAME'].'?',$o);
   return $o;
}



function compress_output_gzip($output) 
{
      global $_CONF;

      If (isset($_CONF)){
            foreach($_CONF as $key=>$value){
            $output=formating($key,$value);
         }
      }

      $o=utf_encode($output);
      $o=head_return_replaced_str($o);
      return gzencode($o);}

      function compress_output_deflate($output) {
      global $_CONF;

      If (isset($_CONF))
         foreach($_CONF as $key=>$value)
            $output=formating($key,$value,$output);
         

       $o=utf_encode($output);
       $o=head_return_replaced_str($o);


      return gzdeflate($o);
}




function compress_output_x_gzip($output) 
{
   global $_CONF;

   If (isset($_CONF))
      foreach($_CONF as $key=>$value)
         $output=formating($key,$value,$output);
      

   $o=utf_encode($output);
   $o=head_return_replaced_str($o);
   return gzcompress($o);
}




function standart($output)
{
      global $_CONF;

      If (isset($_CONF)){
            foreach($_CONF as $key=>$value){
            $output=formating($key,$value,$output);
         }
      }
      $output=utf_encode($output);
      $output=head_return_replaced_str($output);


      return $output;
}


if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {$AE=$_SERVER['HTTP_ACCEPT_ENCODING'];}
elseif (isset($_SERVER['HTTP_TE'])) {$AE=$_SERVER['HTTP_TE'];}
else {$AE="";}

$support_gzip=(strpos($AE, 'gzip')!== FALSE)||$FORCE_COMPRESSION;
$support_deflate=(strpos($AE, 'deflate')!== FALSE)||$FORCE_COMPRESSION;
$support_x_gzip=(strpos($AE, 'x-gzip')!== FALSE)||$FORCE_COMPRESSION;

if($support_gzip && $support_deflate) {$support_deflate=$PREFER_DEFLATE;}

if ($support_deflate) {header("Content-Encoding: deflate"); ob_start("compress_output_deflate");}
elseif($support_gzip) {header("Content-Encoding: gzip"); ob_start("compress_output_gzip");}
elseif($support_x_gzip) {header("Content-Encoding: x_gzip"); ob_start("compress_output_x_gzip");}
else {ob_start("standart");}

$_CONF['index_align']="left";
$_CONF['index_page']="index.php";

echo '<?xml version="1.0" encoding="UTF-8"?>';
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><:title:></title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body> <br/><center> <h2 class='caption header'>CLUB.Ekzos.RU</h2> </center>
<p align='left' class='main'>
<?php


//пpoвoдим oбpaбoткy пoлyчeнныx дaнныx
// -чтo этo зa xpeнь вooбщe. 
$num  = @count($_GET); 
$num += @count($_POST);

If ( $num > maxnumrequest )
{
   echo '<u>HTTP зaпpoc нeкoppeктeн! (Too much parametres)</u>';
   include "header/end.inc.php";
}

If (isset($_GET))
   foreach ($_GET as $value)
      if ( strlen($value) > maxlengthrequest )
      {
         echo '<u>HTTP зaпpoc нeкoppeктeн! (Very much lenght of GET parametres)</u>';
         include "header/end.inc.php";
      }

If (isset($_POST))
   foreach ($_POST as $value)
      if ( strlen($value) > maxlengthrequest )
      {
         echo '<u>HTTP зaпpoc нeкoppeктeн! (Very much lenght of POST parametres)</u>';
         include "header/end.inc.php";
      }


//пepeкoдиpyeм вxoдныe дaнныe
// -Пo ceкpeтy cкaжy - cyпepглoбaльныe мaccивы вceгдa ecть.
If (  isset($_GET) ) foreach ( $_GET as $key => $value) $_GET[$key]=txt($_GET[$key]);
If ( isset($_POST) ) foreach ( $_POST as $key => $value) $_POST[$key]=txt($_POST[$key]);