Файл: jurnal.php
Строк: 67
<?
require_once("core/core.php");
$title = $title . ' :: Журнал';
$location = 'В журнале';
if ($u['id']) {
include 'head.php';
echo '<div class="title"><center>Мой журнал</center></div>';
if (@$_GET['del']) {
$del = num($_GET['del']);
$req = mysql_query("SELECT * FROM `jurnal` WHERE `user` = '" . $u['id'] . "' and `id` = '$del' LIMIT 1");
if (mysql_num_rows($req)) {
mysql_query("DELETE FROM `jurnal` WHERE `id` = '$del'");
echo '<div class="div"><font color="red">Сообщение удалено!</font></div>';
} else {
}
}
if ($u['setting_jurnal_list'])
$count = $u['setting_jurnal_list']; else
$count = 10;
$all = mysql_result(mysql_query("SELECT COUNT(*) FROM `jurnal` WHERE `user` = '" . $u['id'] . "'"), 0);
if ($all > 0) {
$total = intval(($all - 1) / $count) + 1;
@$page = num($_GET['page']);
if (empty($page) or $page < 0)
$page = 1;
if ($page > $total)
$page = $total;
$start = $page * $count - $count;
echo '<div class="nav">';
@$sort = check($_GET['sort']);
if ($sort == 'message') {
$sortq = 'ASC';
echo '<a href = "jurnal.php?&sort=time&page=' . $page . '">Новые</a> | <b>Поcледние</b>';
}
if ($sort == 'time' || empty($sortq)) {
$sort = 'time';
$sortq = 'DESC';
echo '<b>Новые</b> | <a href = "jurnal.php?&sort=message&page=' . $page . '">Поcледние</a>';
}
echo '</div>';
$result = mysql_query("SELECT * FROM `jurnal` WHERE `user` = '" . $u['id'] . "' ORDER BY `time` $sortq LIMIT $start, $count");
while ($jurnal = mysql_fetch_assoc($result)) {
$user = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '" . $jurnal["outuser"] . "'"));
echo '<div class="div">';
if ($user['delete'] == 1) {
echo ' ' . ico($user['sex'], $user['admin'], $user['online']) . ' <a href = "id' . $user['id'] . '"><del><b><font color="#79358c">' . $user['login'] . '</font></b></del></a>';
} else {
echo ' ' . ico($user['sex'], $user['admin'], $user['online']) . ' <a href = "id' . $user['id'] . '"><b><font color="#79358c">' . $user['login'] . '</font></b></a>';
}
echo '' . medal($user['rating']) . '';
echo '<span style="float:right;color:grey;"> ' . vremya($jurnal['time']) . ' </span>';
if ($jurnal['new'] == 1)
echo ' / <font color="red"><small>Не прочитано</small></font>';
echo '<br/> ' . $jurnal['text'] . '';
echo '<span style="float:right;"><a href = "jurnal.php?del=' . $jurnal['id'] . '"><img src="style/page/delete.gif"></a></span>';
echo '<br/>';
if ($jurnal['new'] == 1)
mysql_query("UPDATE `jurnal` SET `new` = 0 WHERE `id` = '" . $jurnal['id'] . "'");
echo '</div>';
}
navigation($page, $total, 'jurnal.php?&sort=' . $sort . '&');
}else {
echo '<div class="div">Пока уведомлений нет!</div>';
}
echo '</div>';
include 'foot.php';
} else {
header("Location: reg.php?err=1");
}
?>