Файл: vkollektive2014/soo/new_t.php
Строк: 63
<?
include_once '../connect.php';
if(isset($_GET['s']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo` WHERE `id` = '".intval($_GET['s'])."' LIMIT 1"),0)==1)
{
$s=intval($_GET['s']);
$soo=mysql_fetch_assoc(mysql_query("SELECT * FROM `soo` WHERE `id` = '$s' LIMIT 1"));
include_once 'inc/ban.php';
$title=$soo['name'].' - Новые темы на форуме'; // заголовок страницы
include_once '../head.php';
if($soo['konf_soo']==0 || isset($user) && mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_users` WHERE `id_soo` = '$soo[id]' AND `id_user`='$user[id]' AND `invit`='0' AND `activate`='0' LIMIT 1"),0)==1 || isset($user) && $user['id']==$soo['admid'] || isset($user) && $user['level']>0)
{
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_forum_thems` WHERE `id_soo`='$s'"),0);
$total = intval(($k_post - 1) / 10) + 1;
$page = intval(@$_GET['page']);
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * 10 - 10;
$q=mysql_query("SELECT * FROM `soo_forum_thems` WHERE `id_soo`='$s' ORDER BY `time_create` DESC LIMIT $start, 10");
if (mysql_num_rows($q)==0) {
echo "Нет тем<br />n";
}
while ($them = mysql_fetch_assoc($q))
{
$forum=mysql_fetch_assoc(mysql_query("SELECT * FROM `soo_forums` WHERE `id` = '$them[id_forum]' AND `id_soo`='$s' LIMIT 1"));
$ank=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $them[id_user] LIMIT 1"));
if($num==1){
echo "<div class='row'>";
$num=0;
}else{
echo "<div class='row2'>";
$num=1;}
if($them['up']==1)echo "<img src='img/forum/them_2.png' alt='' class='icon'/>";
if($them['close']==1)echo "<img src='img/forum/them_1.png' alt='' class='icon'/>";
if($them['up']==0 && $them['close']==0)echo "<img src='img/forum/them_0.png' alt='' class='icon'/>";
echo " <a href='forum.php?s=$s&id_forum=$forum[id]&id_them=$them[id]'>$them[name]</a> <a href='forum.php?s=$s&id_forum=$forum[id]&id_them=$them[id]&page=end'>(".mysql_result(mysql_query("SELECT COUNT(*) FROM `soo_forum_mess` WHERE `id_forum` = '$forum[id]' AND `id_soo`='$s' AND `id_them` = '$them[id]'"),0).")</a> (".vremya($them['time_create']).")<br />n";
$ank=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $them[id_user] LIMIT 1"));
echo "<a href='info.php?s=$soo[id]&id=$ank[id]' title='Анкета "$ank[login]"'>$ank[login]</a> / n";
$post=mysql_fetch_assoc(mysql_query("SELECT * FROM `soo_forum_mess` WHERE `id_them` = '$them[id]' AND `id_soo` = '$soo[id]' AND `id_forum` = '$forum[id]' ORDER BY `time` DESC LIMIT 1"));
if ($post!=NULL){
$ank=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
echo "<a href='/info.php?s=$soo[id]&id=$ank2[id]' title='Анкета "$ank2[login]"'>$ank2[login]</a> (".vremya($post['time']).")n";
}
echo "<br />";
echo "<a href='forum.php?s=$s'>Форум</a> > <a href='forum.php?s=$s&id_forum=$forum[id]'>$forum[name]</a>n";
echo "</div>";
}
if($page>1)navigation($page, $total,'?s='.$s.'&'); // Вывод страниц
echo "<div class="foot">n";
echo "»<a href='new_p.php?s=$s'>Темы с новыми сообщениями</a><br />n";
echo "«<a href="index.php?s=$s" title="Вернуться в соо">В сообщество</a><br />n";
echo "</div>n";
}
else
{
echo'Вам недоступен просмотр новых тем данного сообщества';
}
}
else
{
header("Location:index.php");
}
include_once '../foot.php';
?>