View file lenta/forum.php

File size: 1.13Kb
<?php
$title = 'Лента';
require_once ('../system/fun.php');
require_once ('../system/head.php');

echo '<div class="title">Лента за форум</div>';

if (empty($user['max'])) $user['max']=10;
$max = $user['max'];
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `lenta` WHERE `komy` = '".$user['id']."'"),0);
$k_page = k_page($k_post,$max);
$page = page($k_page);
$start = $max*$page-$max;
$lenta = mysql_query("SELECT * FROM `lenta` WHERE `komy` = '".$user['id']."' and `readlen` = '0' ORDER BY `time` DESC LIMIT $start, $max");
while($l = mysql_fetch_assoc($lenta))
{
echo '<div class="menu">Пользователь: '.nick($l['kto']).' '.bb_code($l['text']).'';
if($l['readlen'] == 0) echo '[<b>Новое</b>]';
echo '</div>';
mysql_query("UPDATE `lenta` SET `readlen` = '1' WHERE `id`='".$l['id']."' limit 1");
}

if($k_post < 1) echo '<div class="menu"><center><b>Пока пусто!</b></center></div>';
if($k_page>1) echo str('/lenta/forum.php?',$k_page,$page); // Вывод страниц

echo '<div class="menu"><a href="/lenta/">Назад</a></div>';

require_once ('../system/foot.php');
?>