Файл: sys/fnc/aut.php
Строк: 76
<?php
function aut() {
global $set;
$rekl = mysql_result(mysql_query("SELECT COUNT(*) FROM `rekl` WHERE `sel` = '1'"), 0);
if ($rekl > 0) {
echo "<div class='rekl'>n";
rekl(1);
echo "</div>n";
}
global $user;
if (isset($user)) {
if (@$_GET['del'] && mysql_result(mysql_query("SELECT COUNT(*) FROM `mess` WHERE `id` = '" . intval($_GET['del']) . "'"), 0) == 1) {
$post = mysql_fetch_assoc(mysql_query("SELECT * FROM `mess` WHERE `id` = '" . intval($_GET['del']) . "' LIMIT 1"));
mysql_query("DELETE FROM `mess` WHERE `id` = '$post[id]'");
}
$q = mysql_result(mysql_query("SELECT COUNT(*) FROM `mess` WHERE `id_kont` = '$user[id]' AND `read` = '0'"), 0);
if ($q != 0) {
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mess` WHERE `id_kont` = '" . $user['id'] . "'"), 0);
$k_page = k_page($k_post, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
$qis = mysql_query("SELECT * FROM `mess` WHERE `id_kont` = '" . $user['id'] . "' ORDER BY id DESC LIMIT 1");
while ($post = mysql_fetch_array($qis)) {
echo "<div class='new'>";
echo "<div class = 'right' id = 'hide'>";
echo "<a href = '?del=$post[id]' title = 'Отметить как прочитанное'><img src = '/style/img/hide.png' /></a>";
echo "</div>";
echo img('email.png') . " " . text::toOutput($post['msg']) . "<br />";
echo "</div>";
}
}
$jn = mysql_result(mysql_query("SELECT COUNT(*) FROM `notification` WHERE `id_kont` = '$user[id]' AND `read` = '0'"), 0);
$jns = mysql_result(mysql_query("SELECT COUNT(*) FROM `notifications` WHERE `id_kont` = '$user[id]' AND `read` = '0'"), 0);
$new_g = mysql_result(mysql_query("SELECT COUNT(*) FROM `myguests` WHERE `id_ank` = '$user[id]' AND `read`='1'"), 0);
$not = $jn + $jns + $new_g;
$not_count = $jn + $jns;
if ($not == 0) {
} else {
echo "<div class = 'even'>";
echo "Новые события";
echo "<div class = 'hr'></div>";
if ($new_g != 0) {
echo "<a href = '/user/guests.php'>" . img('guest.png') . " Мои гости <font color = 'red'>+$new_g</font> </a><br />";
}
if ($jn || $jns > 0) {
echo "<a href = '/user/notification.php'>" . img('notific.png') . " Журнал <font color = 'red'>+$not_count</font></a><br />";
}
echo "</div>";
}
echo "<a href='/info.php'><table class = 'auts'><tr><td class = 'icon14'>";
echo "<img class='Photo' src='/sys/avatar/";
if (is_file(H . "sys/avatar/$user[id].gif")) {
echo "$user[id].gif";
} elseif (is_file(H . "sys/avatar/$user[id].jpg")) {
echo "$user[id].jpg";
} elseif (is_file(H . "sys/avatar/$user[id].png")) {
echo "$user[id].png";
} else {
echo "avatar.png";
}
echo "' />";
echo "</td><td class = 'null'><span class='Name'>";
echo text::gradient("$user[nick]", "$user[ncolor]", "$user[ncolor2]");
echo "</span><br />";
if ($user['welcome'] != NULL) {
echo "<small><i>" . text::toOutput($user['welcome']) . "</i></small><br />";
}
/*
if ($k_new == 1 || $k_new >= 5 && $k_new <= 21 || $k_new >= 25 && $k_new <= 1111111111) {
$mes = "новое сообщение";
} elseif ($k_new >= 2 && $k_new <= 4 || $k_new >= 22 && $k_new <= 24) {
$mes = "новых сообщения";
} elseif ($k_new >= 5 && $k_new <= 20) {
$mes = "новых сообщений";
}
*
*/
echo "</td></tr></table></a>";
} else {
echo "<div class = 'razd'><div class = 'tiptip'>";
echo "<a href = '/aut.php' class = 'button left' title = 'Авторизоваться'>Вход</a>";
echo "<a href = '/reg.php' class = 'button right' title = 'Зарегистрироваться'>Регистрация</a>";
echo "<br />Вы не авторизованы... Функционал сайта ограничен.";
echo "</div></div>";
}
if (isset($user)) {
$leader = mysql_fetch_array(mysql_query("SELECT * FROM `leader`"));
if ($leader['time'] >= TIME) {
echo "<table class = 'lider'><tr><td class = 'icon14'>";
avatar($leader['id'], '30');
echo "</td><td class = 'null'>";
echo "<a class = 'add' style = 'float:right;' href = '/modules/leader/'>" . img('us.png') . " Лидер дня</a>";
user($leader['id']);
echo "</td></tr></table>";
}
}
}