Файл: sys/fnc/aut.php
Строк: 39
<?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 style = 'float:right;' id = 'hide'>";
echo "<a href = '?del=$post[id]' title = 'Отметить как прочитанное'>" . img16('ok.png') . "</a>";
echo "</div>";
echo img16('mail.png') . " " . text::toOutput($post['msg']) . "<br />";
echo "</div>";
}
}
echo "<a href = '/info.php'><table class = 'auts'><tr><td class = 'icon14'>";
echo "<img class = 'imag' width = '40px' 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'>";
echo "<a href = '/aut.php' class = 'add' title = 'Авторизоваться'>Вход</a> ";
echo "<a href = '/reg.php' class = 'add' title = 'Зарегистрироваться'>Регистрация</a>";
echo "</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_user'], '30');
echo "</td><td class = 'null'>";
echo "<a class = 'add' style = 'float:right;' href = '/modules/leader/'>" . img16('votes.png') . " Лидер дня</a>";
user($leader['id_user']);
echo "</td></tr></table>";
}
}
}