Просмотр файла forum/new_themes.php

Размер файла: 2.44Kb
<?php

$title='Новые темы';
require"../system/config.php";
require"../system/func.php";
require"../system/head.php";
require"../system/error.php";

echo'<div class="i">'.$title.'<br></div>';

if(isset($_GET['st'])){$st=cifry($_GET['st']);}else{$st=0;}

if(isset($_POST['str'])){$str=cifry($_POST['str']);}else{$str=0;}

if(!empty($str)){$st=$str*10-10;}
if(empty($st) or $st<0){$st=0;}
$num=10;


$adata=mysql_query("SELECT * FROM `forum_themes`");
$sdata=mysql_query("SELECT * FROM `forum_themes` ORDER BY `timer` DESC LIMIT $st,$num");
$kol=mysql_num_rows($adata);

if($st>$kol){echo'Не верный номер страници'; require"../system/foot.php"; exit;}
if($kol==""){
echo'<div class="p">
ERROR<br>
</div>';
echo'<div class="i">Найдено '.$kol.' тем</div>';
}else{
while($ofile=mysql_fetch_array($sdata)){ $idkd=$ofile['id_them'];
echo'<div class="p">';
$oofile=mysql_fetch_array(mysql_query("SELECT * FROM `forum_messages` WHERE `id_them`='$idkd'"));
$afilee=$ofile['id_user'];
$oile=mysql_fetch_array(mysql_query("SELECT `login` FROM `users` WHERE `id_user`='$afilee'"));


echo'Тема: <a href="/forum/theme/'.$ofile['id_kat'].'/'.$ofile['id_them'].'/">'.$ofile['ftname'].'</a> ';

$messages=mysql_num_rows(mysql_query("SELECT * FROM `forum_messages` WHERE `id_them`='$idkd'")); if($messages>10){ $stbud=round($messages,-1); $skcf=strlen($messages);

$poslc=substr($messages,($skcf-1),$skcf);
if($poslc>=5 or $poslc=='0'){$stbud=$stbud-10;}
echo'[<a href="/forum/theme/'.$ofile['id_kat'].'/'.$ofile['id_them'].'/page='.$stbud.'"><b>&#187;</b></a>]';
}
echo' <br>Дата: '.date_fixed($ofile['timer']).'<br>Сообщение: '.vizual(mb_substr($ofile['fttext'],0,250,'UTF-8')).'<br><b>Хто:</b> '.nik_two($afilee).'</div> ';
}}
if($st!=0){
echo'<div class="p"><img src="../design/default/act.gif" alt="-"> <a href="new_themes.php?st='.($st-$num).'&amp;'.$s.'">Назад</a><br></div>';
}

if($kol>$st+$num){
echo'<div class="p"><img src="../design/default/act.gif" alt="-"> <a href="new_themes.php?st='.($st+$num).'&amp;'.$s.'">Вперед</a><br></div>';}

if($kol>10){
echo'<div class="p">
<form action="new_themes.php?'.$s.'" method="post">
На страницу (1-'.ceil(($kol/10)).'):<br>
<input type="text" name="str" maxlength="4" class="form" size="3" value="'.ceil(($kol/10)).'">
<input type="submit" value="ОК"  class="but"><br>
</form></div>';}
require"../system/foot.php";
?>