View file temi.php

File size: 4.05Kb
<?php
$us=$_GET['id'];
$ps=$_GET['ps'];
$id_rz=intval($_GET['id_rz']);

$us=mysql_escape_string(htmlspecialchars(trim($us)));
$ps=mysql_escape_string(htmlspecialchars(trim($ps)));
include("ini.php");
$login = autorize();
if($login) {
@mysql_query("update `c_users` set `ltime`='".time()."', `room`='forum', `nev`='0' where `id`='".$id."';");
}
if($id_rz){
$razdel_zagr = @mysql_query("SELECT * FROM `c_forum_razdel` WHERE `id`='".$id_rz."';");
$osn_razd = @mysql_fetch_array($razdel_zagr);
$kategor_rz = $osn_razd['kategor'];
if($kategor_rz==3){
if($liven_us<3)header("Location:index.php?f=$f");
}
if($kategor_rz==2){
if(!$id_us)header("Location:index.php?f=$f");
}

include("head.php");
if($login)
echo "[<a href=\"online.php?f=$f&amp;id=$id&amp;ps=$ps\">Онлайн (<b>".$itog_forr_f['count(*)']."</b>)</a>]<br/>";
else
echo "[<a href=\"reg.php?f=$f&amp;ref=$ref\">Регистрация</a>]<br/>[<a href=\"online.php?f=$f\">Онлайн (".$itog_forr_f['count(*)'].")</a>]<br/>";
if($login) echo "<a href=\"add.php?f=$f&amp;id=$id&amp;ps=$ps&amp;id_rz=$id_rz\">Новая тема</a><br/>";

echo "Темы раздела:<br/>";

$query = @mysql_query("SELECT COUNT(*) FROM `c_forum_tema` WHERE `razdel`='".$id_rz."' ;");
$all = @mysql_result($query, 0);
if(isset($_GET['s'])) $s = intval($_GET['s']);
else $s = 0;
if($s < 0) $s = 0;
if($s > $all) $s = 0;
$c = $s + 1;
if($all==0) echo "Данный раздел ПУСТ<br/><br/>";
$tema_viv = @mysql_query("SELECT * FROM `c_forum_tema` WHERE `razdel`='".$id_rz."' ORDER BY `poschen` DESC LIMIT $s, 13;");
while($itog_tem = mysql_fetch_array($tema_viv))
{
$id_tm = $itog_tem['id'];
$nazwan_tm = $itog_tem['nazwan'];
$date_tm = $itog_tem['date'];
$utwerdil_tm = $itog_tem['utwerdil'];
$kto_tm = $itog_tem['kto'];
$liven_tm = $itog_tem['liven'];
$msg_viv = @mysql_query("SELECT count(*) FROM `c_forum_msg` WHERE `razdel`='".$id_rz."' and `tema`='".$id_tm."';");
$itog_mgs = mysql_fetch_array($msg_viv);

$user_kto=@mysql_query("SELECT * FROM `c_users` WHERE `id` = '".$kto_tm."';");
$kto_user=@mysql_fetch_array($user_kto);
if($login){
if(($liven_us>3)&&(($liven_tm<$liven_us)or($kto_tm==$id)))echo"<a href=\"mod.php?f=$f&amp;id=$id&amp;ps=$ps&amp;id_rz=$id_rz&amp;id_tm=$id_tm\">m</a> ";
if($utwerdil_tm=='0')echo "<b>#!</b>";
echo "<a href=\"msg.php?f=$f&amp;id=$id&amp;ps=$ps&amp;id_rz=$id_rz&amp;id_tm=$id_tm\">$nazwan_tm</a> [".$itog_mgs['count(*)']."]<br />
[<small>Создана: $date_tm | Автор: <b><a href=\"inslide.php?f=$f&amp;id=$id&amp;ps=$ps&amp;id_an=".$kto_user['id']."\">".$kto_user['nik']."</a></b></small>]<br/>----<br/>";
}else{
if($utwerdil_tm=='0')echo"<b>#!</b>";
echo "<a href=\"msg.php?f=$f&amp;id_rz=$id_rz&amp;id_tm=$id_tm\">$nazwan_tm</a> [".$itog_mgs['count(*)']."]<br />
[<small>Создана: $date_tm | Автор: ".$kto_user['nik']."</small>]<br/><br />";}
$c++;
}

if($all>13)echo "<br />";
if($login) {
if ($s > 0)  echo "<a href=\"?f=$f&amp;id=$id&amp;ps=$ps&amp;id_rz=$id_rz&amp;s=".($s-13)."\">&lt;&lt;&lt;&lt;</a> |";
if ($all > $s + 13)  echo "| <a href=\"?f=$f&amp;id=$id&amp;ps=$ps&amp;id_rz=$id_rz&amp;s=".($s+13)."\">&gt;&gt;&gt;&gt;</a>";
}else{
if ($s > 0)  echo "<a href=\"?f=$f&amp;id_rz=$id_rz&amp;s=".($s-13)."\">&lt;&lt;&lt;&lt;</a> |";
if ($all > $s + 13)  echo "| <a href=\"?f=$f&amp;id_rz=$id_rz&amp;s=".($s+13)."\">&gt;&gt;&gt;&gt;</a>";
}
if($all>15)echo "<br/><br/>";

if($login) echo "<a href=\"add.php?f=$f&amp;id=$id&amp;ps=$ps&amp;id_rz=$id_rz\">Новая тема</a><br/>";
if($login)
echo "<a href=\"index.php?f=$f&amp;id=$id&amp;ps=$ps\">Разделы</a><br/>";
else
echo "<a href=\"index.php?f=$f\">Разделы</a><br/>";
$msgrr_viv = @mysql_query("SELECT count(*) FROM `c_forum_msg` WHERE `razdel`='".$id_rz."';");
$itogrr_mgs = mysql_fetch_array($msgrr_viv);
echo "<b>Статистика:</b><br/>
Всего тем: ".$all."<br/>
Ответов: ".$itogrr_mgs['count(*)']."<br/>";
include("foot.php");
}else{
if($login)
header("Location:index.php?f=$f&id=$id&ps=$ps");
else
header("Location:index.php?f=$f");
}
?>