Файл: jurnal.php
Строк: 96
<?
include 'connect.php';
if($u['id']){
include 'head.php';
echo '<div class="title"><img src= "ico/jurnal.gif"><a href = "jurnal.php"> Мой журнал</a> <b>Просмотр события</b></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">';
if ($page != $total) {
echo '<a name="page-up" style="float: right; text-decoration: none;" href="#page-down"><img src = "ico/page_down.png"></a>';
}
$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 $i % 2 ? '<div class="div">' : '<div class="div">';
if(ban($user['id'])){
echo ' '.ico($user['sex'],$user['admin']).' <a href = "/'.$user['id'].'"> <del>'.$user['login'].'</del></a> '.online($user['online']).' ';
} else {
echo ' '.ico($user['sex'],$user['admin']).' <a href = "/'.$user['id'].'"> '.$user['login'].'</a> '.online($user['online']).' ';
}
if($user['rating']>=1000 && $user['rating']<=1999)echo "<img src='ico/b.png' alt='' class='icon'</a>n";
if($user['rating']>=2000 && $user['rating']<=2999)echo "<img src='ico/s.png' alt='' class='icon'</a>n";
if($user['rating']>=3000)echo "<img src='ico/z.png' alt='' class='icon'</a>n";
echo '<small> '.vremya($jurnal['time']).' </small>';
if($jurnal['new'] == 1) echo ' / <font color="red"><small>Не прочитано</small></font>';
echo '<br/> '.$jurnal['text'].'</br>';
echo ' <a href = "jurnal.php?del='.$jurnal['id'].'">Удалить</span>';
echo '<br/>';
if($jurnal['new'] == 1) mysql_query("UPDATE `jurnal` SET `new` = 0 WHERE `id` = '".$jurnal['id']."'");
echo '</div>';
$i++;
}
echo '<div class="nav">';
if ($page != $total) {
echo '<a name="page-down" style="float: right; text-decoration: none;" href="#page-up"><img src = "ico/page_up.png"></a>';
}
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>';
navigation($page, $total,'jurnal.php?&sort='.$sort.'&');
}else{
echo '<div class="div"><img src="ico/error.gif" alt="Ошибка" /> У Вас еще нет сообщений в журнале!</div>';
}
echo '</div>';
include 'foot.php';
} else {
header ("Location: registration.php?err=1");
}
?>