<?php

echo '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
<head>
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="format-detection" content="telephone=no"/>
    <meta name="author" content="TheFlash" />
    <meta name="description" content="Помощь начинающим мастерам" />
    <meta name="keywords" content="WAP-мастер, справочники, шаблоны, форум, как создать сайт, DLE, WordPress,скачать скрипт" />
    <meta name="Reply-to" content="theflash@justwm.ru"/>
    <meta name="copyright" content="ReLife Media Inc." />
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="viewport" content="width=device-width, user-scalable=yes"/>
    <link rel="shortcut icon" href="/design/style/favicon.png">
	<link rel="stylesheet" href="'.$HOME.'/design/theme/efff.css" type="text/css" />';
	echo '<link rel="stylesheet" href="'.$HOME.'/design/theme/bysomon/style.css" type="text/css" /> ';
    $config = mysql_fetch_assoc(mysql_query("SELECT * FROM `config` WHERE `id` = '1'"));
    


echo '<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>';
echo ' <title>'. $title .'</title>
</head>
<body>';
$t = microtime(1);

echo '<a href="'.$HOME.'"><div class="logo"><img src="'.$HOME.'/design/theme/bysomon/logo.png" alt="'.$HOME.'" title="'.$HOME.'" /></a></div> ';
if(!isset($user['id'])) {
echo '<div class="auth"><a  href="/login.php">Авторизация</a> <a  href="/registr.php">Регистрация</a></div>';

} 
if(isset($user['id'])) {
$len = mysql_result(mysql_query("SELECT COUNT(id) FROM `lenta` WHERE `komy` = '".$user['id']."' and `readlen` = '0'"),0);
$mes = mysql_result(mysql_query("SELECT COUNT(id) FROM `message` WHERE `komy` = '".$user['id']."' and `readlen` = '0'"),0);
$load_mod = mysql_result(mysql_query("SELECT COUNT(*) FROM `load_file` WHERE `mod` = '0'"), 0);
$reg_mod = mysql_result(mysql_query("SELECT COUNT(*) FROM `reg` WHERE `dop` = '3'"), 0);
$arb = mysql_result(mysql_query("SELECT COUNT(*) FROM `arb` WHERE `prinyat` = '0'"), 0);
echo '<div class="auth">
<td><a href="/kab.php"><center> '.$user['login'].'</center></a></td>
<td ><a href="/exit.php"><center> Выход</center></a></td></div>';
}
echo '' .($mes > 0 ? '<div class="podmenu">
<a href="'.$HOME.'/mes/">Почта <font color="red"><b>+'.$mes.'</b></font></a></div>' : '').' ';
echo '' .($len > 0 ? '<div class="podmenu">
<a href="'.$HOME.'/lenta.php">Лента <font color="red"><b>+'.$len.'</b></font></a></div>' : '').' ';

$rek = mysql_result(mysql_query("SELECT COUNT(id) FROM `ads` WHERE `time_srok` > '".time()."' and `tip` = '0'"),0);
$sql_rek = mysql_query("SELECT * FROM `ads` WHERE `time_srok` > '".time()."' and `tip` = '0' ORDER BY rand() ");

##Блок рекламы
if($rek != 0) {
echo '<div class="rekl"> Реклама:</div>';
echo '<div class="podmenu">';
while($sql = mysql_fetch_assoc($sql_rek)){
echo '<a href="'.$sql['url'].'"><img src="'.$HOME.'/images/rr.png" alt="*" title="Реклама" /> ';

echo '<font color="'.$sql['color'].'">'; 
if($sql['b'] == 1) echo '<b>'; 
if($sql['i'] == 1) echo '<i>';
echo $sql['name'];
if($sql['i'] == 1) echo '</i>';
if($sql['b'] == 1) echo '</b>'; 
 echo '</font>';
echo '</a>';
if($rek > 1) echo '<br/>';
}

echo '</div>';
}

if(isset($user['id'])) {
if($user['wp'] == 0) {
echo '<div class="podmenu"><font color="red"><a href="/billing/wmid.php">У вас не заполнены данные WMR и WMID просим вас заполнить их и потвердите!</font></a></div>';
}
if($user['level'] >= 1) echo ' ' .($load_mod > 0 ? '<div class="podmenu">
<a href="'.$HOME.'/panel/load_mod">Модерация файлов <font color="red"><b>+' . $load_mod . '</b></font></a> </div>' : '').' ';

if($user['level'] >= 2) echo ' ' .($reg_mod > 0 ? '<div class="podmenu">
<a href="'.$HOME.'/panel/reg_mod">Модерация регистраций <font color="red"><b>+' . $reg_mod . '</b></font></a> </div>' : '').' ';
if($user['level'] >= 3) echo ' ' .($arb > 0 ? '<div class="podmenu">
<a href="'.$HOME.'/panel/arb">Модерация арбитража<font color="red"><b> +' . $arb . '</b></font></a> </div>' : '').' ';

}

?>