Просмотр файла news.php

Размер файла: 2.21Kb
<?php
include_once "config.php";
include_once "inc/inc.php";
include_once "inc/func.php";
include_once "inc/user.php";
include_once "inc/gzip.php";
include_once "inc/online.php";
include_once "themes/$theme/index.php";

echo '<center>Новости сайта</center><hr>';

$vsego = mysql_num_rows(mysql_query("SELECT * FROM " . $pref . "news"));
$pagevsego = $vsego / $kolnews;
$pagevsego = (int)$pagevsego;
$bbb = $vsego - ($pagevsego * $kolnews);
if ($bbb > 0) {
    $pagevsego++;
} 
$page = (int)$page;
if ($page >= $pagevsego) {
    $page = $pagevsego;
} 
if ((!isset($page)) || ($page <= 0) || ($page == '')) {
    $page = 1;
    $start = 0;
} else {
    $start = ($page * $kolnews) - $kolnews;
} 
// if($page>=$pagevsego){$page=$pagevsego;}
// $vsego = mysql_num_rows(mysql_query("SELECT * FROM ".$pref."book"));
// $query = "SELECT * FROM ".$pref."book LIMIT $start, $kolbook ORDER BY id DESC";
$query = "SELECT * FROM " . $pref . "news ORDER BY id DESC LIMIT $start, $kolnews";
$result = mysql_query($query);
// echo $start;
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo '<div class="b">[' . $line['data'] . '] [' . $line['vrem'] . ']</div>';
    $soob = smile($line[msg]);
    echo $soob . '<br>';
    echo '[Разместил - <a href="/setting/anketa.php?id=' . $line['id_user'] . '">' . $line['login'] . '</a>]<br>'; 
    // if (strlen($line['otvet'])>=2){echo'<font color="red"><u>Ответ администрации:</u></font><br><font color="#aa0000">'.$line['otvet'].'</font><br>';}
} 

echo '<hr>Страницы:<br>';
if ($page == '1') {
    echo'&lt;-Назад';
} else {
    $ggg = $page-1;
    echo '<a href="news.php?page=' . $ggg . '">&lt;-Назад</a>';
} 
echo ' [' . $page . ' из ' . $pagevsego . '] ';
if (($page == $pagevsego) || ($pagevsego == 0)) {
    echo 'Вперёд-&gt;<br>';
} else {
    $ggg = $page + 1;
    echo '<a href="news.php?page=' . $ggg . '">Вперёд-&gt;</a><br>';
} 
echo '<form action="news.php" method="get">';
echo '<input name="page" type="text" value=""><input type="submit" value="&gt;&gt;">';
echo '</form>';
echo '<hr>Всего новостей: ' . $vsego;

include_once "themes/$theme/foot.php";

?>