File size: 2.31Kb
<?php
if (isset($_POST['del_line']))
{
include_once($cms.'flud/func/files.php'); //библиотека для работы с файлами
if ($_SESSION['del'] != $_POST['del'])
{
del_line($cms,'news/coment/'.trim($fn[0]).'.txt',$_POST['del_line']); // удаленеи любой строки из файла
$_SESSION['del'] = $_POST['del'];
}
}
if (@filesize($cms.'news/coment/'.trim($fn[0]).'.txt') == 0 || !is_file($cms.'news/coment/'.trim($fn[0]).'.txt')) echo 'Комментариев нет';
else
{
$st_r = 10;
// столько выводим
if (is_file($cms.'news/coment/'.trim($fn[0]).'.txt')) $post = @file($cms.'news/coment/'.trim($fn[0]).'.txt'); else echo 'Ошибка';
$count_post = count($post);
if (empty($_POST['fapages'])) {
$pages = 1;
} else {
$pages = (int) $_POST['fapages'];
}
$j = ($count_post-1)-(($pages-1)*$st_r);
$i = $j-$st_r;
for(; $i<$j && $j>=0; $j--)
{
$fn = explode("|",$post[$j]);
echo '
<div class="mess1">
<div >'.$fn[0].' - '.$fn[1].'';
if (is_file($cms.'moder/'.$_SESSION['user_login'].'.txt'))
{
echo '
<form name="" action="" method="post">
<input name="fapages" type="hidden" value="'.$_POST['fapages'].'">
<input name="del_line" type="hidden" value="'.$j.'">
<input name="del" type="hidden" value="'.md5($fn[2]).$j.'">
<input type="submit" class="knopka" value="x">
</form>
';
}
echo '</div>
</div>
<div class="mess2">'.$fn[2].'</div>
<br />
';
}
$tr = 0;
$all = ceil($count_post/$st_r);
echo '<table><tr>';
for ($i=1;$i<=$all;$i++)
{
$tr+=1;
if ($tr > 20)
{
echo '</tr><tr>';
$tr = 0;
}
if ($pages==$i) {
echo '<td><b class="knopka">'.$i.'</b></td>';
}
else
{
echo '<td>
<form name="" action="" method="post">
<input type="submit" class="knopka" value="'.$i.'">
<input name="fapages" type="hidden" value="'.$i.'">
</form>
</td>';
}
}
echo '</tr></table>';
}
?>