<?
if (eregi('windows', $_SERVER["HTTP_USER_AGENT"]) ||
eregi('linux', $_SERVER["HTTP_USER_AGENT"]) ||
eregi('bsd', $_SERVER["HTTP_USER_AGENT"]) ||
eregi('x11', $_SERVER["HTTP_USER_AGENT"]) ||
eregi('unix', $_SERVER["HTTP_USER_AGENT"]) ||
eregi('macos', $_SERVER["HTTP_USER_AGENT"]) ||
eregi('macintosh', $_SERVER["HTTP_USER_AGENT"])
)
{
$web_browser=1;
if (isset($user) && $user['them2']!='' && is_dir(BASEDIR."SYSTEM/themes/$user[them2]"))
{
$them=$user['them2'];
}
else
{
if (isset($_COOKIE['theme']))
$them=$_COOKIE['theme'];
else
$them=$set['them2'];
}

}
else
{
$web_browser=0;
if (isset($user) && $user['them']!='' && is_dir(BASEDIR."SYSTEM/themes/$user[them]"))
{
$them=$user['them'];
}
else
{
if (isset($_COOKIE['theme']))
$them=$_COOKIE['theme'];
else
$them=$set['them'];
}
}




function head ()
{
global $them, $title, $set, $color;
include_once BASEDIR."SYSTEM/themes/$them/head.php";
include_once BASEDIR."SYSTEM/themes/$them/color.php";
}

function foot ()
{
global $them,$set,$headtime,$Content_Encoding, $color,$gzip,$user,$online,$onl,$counter,$mesto,$ip,$ip_1,$ip_2,$ip_op,$ua,$sess, $mysql;

$url="$_SERVER[SCRIPT_NAME]";
if (!isset($mesto))
{
$metso="$url";
}
if (isset($user) && !eregi('exit.php',$_SERVER['SCRIPT_NAME']))
{
$pereh=$user['pereh']+1;
mysql_query("UPDATE `$mysql[pref]users` SET `ip` = '$ip', `url` = '$url', `mesto` = '$mesto', `ip_1` = '$ip_1', `ip_2` = '$ip_2', `ip_op` = '$ip_op', `ua` = '$ua', `pereh` = '$pereh', `time` = '".time()."', `sess` = '$sess' WHERE `id` = '".$user['id']."';");
}

mysql_query("UPDATE `$mysql[pref]online` SET `ip` = '$ip', `ua` = '$ua', `url` = '$url', `mesto` = '$mesto' WHERE `sess` = '$sess';");



$counter_text="[$counter[host] / $counter[all]]<br />\n";
$counter_img="<img src=\"http://".$_SERVER['HTTP_HOST']."/counter/index.php\" alt=\"счетчик\" width=\"80\" height=\"30\" /><br />\n";


$end=$set['end'];

if ($mesto=='На главной')
{
$end=stripcslashes($set['end']);
}
else
{
$end=stripcslashes($set['end_all']);
}
if ( $set['end_mob']==1 && (
eregi('windows', $_SERVER["HTTP_USER_AGENT"]) ||
eregi('linux', $_SERVER["HTTP_USER_AGENT"]) ||
eregi('bsd', $_SERVER["HTTP_USER_AGENT"]) ||
eregi('x11', $_SERVER["HTTP_USER_AGENT"]) ||
eregi('unix', $_SERVER["HTTP_USER_AGENT"]) ||
eregi('macos', $_SERVER["HTTP_USER_AGENT"]) ||
eregi('macintosh', $_SERVER["HTTP_USER_AGENT"]))
)
{
$end='';
}


$Contents = ob_get_contents();
$gzib_file = strlen($Contents);
if ($Content_Encoding['deflate'])

$gzib_file_out = strlen(gzdeflate($Contents,9));

elseif($Content_Encoding['gzip'])

$gzib_file_out = strlen(gzencode($Contents,9));

else

$gzib_file_out = strlen($Contents);

$compress=round(100-(100/($gzib_file/$gzib_file_out)),1);




list($msec, $sec) = explode(chr(32), microtime());

$tgen=round(($sec + $msec) - $headtime, 3);

include_once BASEDIR."SYSTEM/themes/$them/foot.php";

ob_end_flush();

exit;

}



?>

