Файл: gb/index.php
Строк: 49
<?php
include_once '../inc/bd.php';
include_once '../inc/fun.php';
$title = 'Гостевая';
include_once '../inc/v.php';
####
echo '<div class="smenu"><a href="'.$home.'/gb/say.php">Добавить</a></div>';
####
$all = mysql_result(mysql_query("SELECT COUNT(*) FROM `gb`"), 0, 0);
####
$get = num($_GET['page']);
if(isset($get))
{$page = $get;}
else{$page=1;}
$str = ceil($all/$npage);
if(!$str) $pages = 1;
if($page>$str or $page<=0) $page=1;
if($start>$all or $start<=0) $start = 0;
if($page) $start = ($page - 1) * $npage;
else $start = 0;
####
if ($all > 0)
{$sql = mysql_query("SELECT * FROM `gb` ORDER BY `id` DESC LIMIT $start,$npage");
while ($row = mysql_fetch_assoc($sql))
{$id = num($row['id']);
$user = antirek(html($row['user']));
if ($user == $adminlogin) {$user = '<font color="990000">'.$user.' (УКДПЕ)</font>';}
$date = $row['date'];
$text = html($row['text']);
$text = nl2br($text);
$text = parsebb(smiles($text));
####
echo '<div class="menu">';
if ($version == web){echo '<img src="'.$home.'/img/user_web.png"/> ';}
else {echo '<img src="'.$home.'/img/user.png" alt=""> ';}
if(mysql_result(mysql_query("select count(`id`) from `users` where `login`='".mysql_real_escape_string($row['user'])."' limit 1;"), 0)) {
$user = $row['user'];
echo '<a href="'.$home.'/profile/?u='.mysql_real_escape_string($row['user']).'"><strong>'.$user.'</strong></a> (<a href="'.$home.'/gb/say.php?id='.$idst.'&u='.$id.'">отв</a>)| ';
} else echo '<a href="'.$home.'/gb/say.php?id='.$idst.'&u='.$id.'"><strong>'.$user.'</strong></a> | ';
echo '<span style="font-size:9px">'.$date.'</span><br/>'.($user != $adminlogin ? replace($text) : $text).'</div>';
}
####
$pp = $page - 2;
$pp2 = $page + 3;
$backpage = $page - 1;
$uppage = $page + 1;
if ($str>1){
echo '<div class="nmenu">';
if ($page > 1)
echo '<a class="str" href="'.$home.'/gb/?page='.$backpage.'">«</a> ';
if($pp<$all && $pp>0 && $page>3)
echo '<a class="str" href="'.$home.'/gb/?page=1">1</a> ... ';
for($i=$pp; $i<$pp2;$i++)
{
if($i<$all && $i>0)
{
if ($i > $str )
break;
if ($page==$i)
echo '<span class="str_active"><b>'.$i.'</b></span> ';
else echo '<a class="str" href="'.$home.'/gb/?page='.$i.'">'.$i.'</a> ';
}
}
if ($i <= $str) {if($pp2<$all) echo ' ... <a class="str" href="'.$home.'/gb/?page='.$str.'">'.$str.'</a>';}
if ($page < $str)
{
echo '<a class="str" href="'.$home.'/gb/?page='.$uppage.'">»</a> ';
}
echo '</div>';
}
}
else {echo '<div class="menu">Сообщений нет! Будь первым =)</div>';}
####
include_once '../inc/n.php';
?>