Размер файла: 4.74Kb
<?php
include '../header/config.inc.php';
include '../header/function.inc.php';
include '../header/header.inc.php';
include '../header/connect.inc.php';
include '../header/click-club.class.php';
If (!isset($_GET['log'])) define("anybody","true");
include '../header/enter.inc.php';
include '../ban.php';
mysql_query("update `".prefix."users` set `mesto`='В комментариях к акциям', `online`='".time()."' where `id` = '".$_USER['id']."';");
$news_id = mysql_escape_string(trim(intval($_GET['news_id'])));
$sql = mysql_query("SELECT * FROM `akcii` WHERE `id` = '$news_id'");
if (mysql_num_rows($sql) < '1') {
header("Location: /akcii/");
}
If (!isset($_GET['page']) || !is_numeric($_GET['page'])) $page=1;
else { $page=htmlspecialchars(mysql_real_escape_string(trim($_GET['page']))); (int)$page;}
$result=mysql_query("SELECT * FROM `akcii_comment` WHERE `news_id` = '$news_id' ORDER BY `id` DESC LIMIT ".(($page-1)*num_best_on_page).",".(num_best_on_page+1));
If (!$result){
echo '<div class="menuindex">Oшибкa зaпpoca к бд...</div>';
break;
}
echo'<div class="downsw"><a href="/akcii/"><b>Акции</b></a> » <b>Комментарии</b></div>';
echo'<div class="menuindex"><a href="comm.add.php?news_id='.$news_id.'"><b>Добавить</b></a></div>';
$next=false;
$num=mysql_num_rows($result);
If ($num>0){
If ($num<=num_best_on_page) $read=$num; else {
$read=num_best_on_page;
$next=true;
}
for ($i=0;$i<$read;$i++){
$id = ''.mysql_result($result,$i,'id').'';
$user = ''.mysql_result($result,$i,'user').'';
$login = ''.mysql_result($result,$i,'user').'';
$date = ''.mysql_result($result,$i,'date').'';
$text = ''.mysql_result($result,$i,'text').'';
$anss = ''.mysql_result($result,$i,'ans').'';
$ansuser = ''.mysql_result($result,$i,'ansuser').'';
$text = smiles(parsebb(smile(antirek(antimat(stripslashes(nl2br($text)))))));
// $text=smiles($text);
//$text=smile($text);
$d = mysql_query("select * from `".prefix."users` where login='".$user."'");
$dat = mysql_fetch_array($d);
$time = time();
$online = ($dat['online'] > ($time - 300));
switch($dat['online'])
{
case $online: $online='[<font color="#00AA00">On</font>]'; break;
default: $online='[<font color="red">Off</font>]'; break;}
$ggg=mysql_query("SELECT * FROM `".prefix."users` WHERE `login`='".$user."'");
$row=mysql_fetch_array($ggg);
$admin=$row['admin'];
$mod=mysql_query("SELECT * FROM `".prefix."moderka` WHERE `mod`='".$user."'");
$rowj=mysql_fetch_array($mod);
$moders=$rowj['ml'];
if($moders=='1') $user ="<font color='0000aa'>".$user."</font></a> ";
if($moders=='2') $user ="<font color='11aa11'>".$user."</font></a> ";
if($admin=='1') $user ="<font color='ff0000'>".$user."</font></a> <img src='/images/admin.png' alt='!'/>";
/////////////////////////////////////////////
if ($dat[pol]=="Мужской")
{
$img_pol='<img src="/images/pol/m.png"/>';
}
if ($dat[pol]=="Женский")
{
$img_pol='<img src="/images/pol/j.png"/>';
}
$mode=mysql_query("SELECT * FROM `".prefix."moderka` WHERE `mod`='".$_USER['login']."'");
If(!$mode){echo 'err';}
if (mysql_num_rows($mode)!=0){
$moder = $_USER['login'];
}
If ($_USER['admin'] || $moder){$adm ='[<a href="comm.del.php?id='.$id.'&news_id='.$news_id.'"><font color="red">del</font></a>] [<a href="comm.ans.php?id='.$id.'&news_id='.$news_id.'"><font color="green">Aотв</font></a>]'; }
if($_USER['login']==$login || $_USER['admin']) {$edit='[<a href="comm.edit.php?id='.$id.'&news_id='.$news_id.'"><font color="green">ред</font></a>]';}
else{$edit='';}
if (!empty($anss)) {
$ans = smiles(smile(parsebb(stripslashes(nl2br(htmlspecialchars($anss))))));
$ans = '<div class="reply"><b><font color ="green">'.$ansuser.':</font></b> <br /><font color ="red">'.$ans.'</font></div>';
} else {
$ans = '';
}
echo '
<div class="menuindex"><a href="/info.php'.$_zapros.'user='.$login.'">'.$img_pol.' <b>'.$user.'</b></a>'.$online.' <small>['.$date.']</small> '.$adm.' [<a href="comm.add.php?news_id='.$news_id.'&user='.$login.'"><font color="green">отв</font></a>]'.$edit.'<br />'.$text.'
'.$ans.'</div>';
}
} else echo '<div class="menuindex">Комментариев еще нет! Будь первым!</div>';
echo '<div class="menuindex">';
If ($page>1) echo '<a href="'.$_zapros.'news_id='.$news_id.'&page='.($page-1).'">';
echo '« Haзaд';
If ($page>1) echo '</a>';
echo ' | ';
If ($next) echo '<a href="'.$_zapros.'news_id='.$news_id.'&page='.($page+1).'">';
echo 'Дaлee »';
If ($next) echo '</a>';
echo '</div>';
///////////////////////////////////////
include "../header/end.inc.php";
?>