Файл: anibiliwar.ru/journal.php
Строк: 32
<?
# All author: XxxDIABLOxxX
# pabl mosule
# journal.php
include './system/common.php';
include './system/functions.php';
include './system/user.php';
if(!$user) {
header('location: /');
exit;
}
$title = 'Журнал';
include './system/h.php';
# title
echo '<div class="title">'.$title.'</div>
<div class="line"></div>';
# page
$max = 10;
$count = mysql_result(mysql_query('SELECT COUNT(*) FROM `journal` WHERE `from` = "'.$user['id'].'" ORDER BY `time`'),0);
$pages = ceil($count/$max);
$page = _string(_num($_GET['page']));
if($page > $pages) $page = $pages;
if($page < 1) $page = 1;
$start = $page * $max - $max;
if($count > 0) {
$q = mysql_query('SELECT * FROM `journal` WHERE `from` = "'.$user['id'].'" ORDER BY `time` DESC LIMIT '.$start.', '.$max.'');
while($row = mysql_fetch_array($q)) {
# read for msg user
if($row['read'] == 0) mysql_query('UPDATE `journal` SET `read` = "1" WHERE `from` = "'.$user['id'].'"');
# msg user number count
echo '<div class="content">
Событие: '.$row['text'].'<br />
Отправлено в ['.date('d.m.y в H:i', $row['time']).']
<br />Статус: ';
# row read status
if($row['read']==0) echo 'Не прочитано'; else echo 'Прочитано';
echo '</div>
<div class="line"></div> ';
}
# page
echo '<div class="line">
<li> '.pages('/journal.php?').'</li>
</div>';
}
else
{
# not msg
echo '<div class="content"><font color="#909090">Журнал пуст</font></div>';
}
include './system/f.php';
?>