Файл: forum.php
Строк: 456
<?php
include 'inc/mysql.php';
include 'inc/check.php';
if(isset($_SESSION['auth']) && $_SESSION['auth']==1){
include 'inc/shapka.php';
echo'<div class="menudiv">Форум</div>';
switch($_GET[mod]){
default:
echo '<br />';
$qi = mysql_query("SELECT * FROM `forum` ORDER by `id` ASC");
$avto = mysql_num_rows($qi);
if($avto>=1){
While($row= mysql_fetch_array($qi))
{
$kolic = mysql_query("SELECT COUNT(`msg`) FROM `forum_msg` WHERE `topik`='$row[id]';");
$kols = mysql_result($kolic, 0);
$u=mysql_query("SELECT * FROM `forum_topik` WHERE `razdel`='$row[id]' ORDER by `id` DESC");
$dat=mysql_fetch_array($u);
$uids=$dat[tema];
$u2=mysql_query("SELECT * FROM `forum_msg` WHERE `topik`='$row[id]' and `tema`='$dat[id]' ORDER by `id` DESC");
$dat2=mysql_fetch_array($u2);
$uids2=$dat2[user];
$req1 = mysql_query("SELECT `id`,`status`,`login`,`sex` FROM `account` WHERE `id` = '$uids2'");
$_user = mysql_fetch_array($req1);
echo'<center><a href="forum.php?mod=theme&id='.$row[id].'" class="menu_j"><img src="pic/main/forum.png" alt="" style="border:1px solid #131313;border-radius:2px;height:16px;width:16px"/> '.$row[name].' ('.$row[tem].'/'.$kols.')</a></center>';
}}else{
echo'<div style="text-align:left;padding:6px;color:#a5a5a5" class="menu_link3">';
echo"<img src="pic/main/!.png"> Нет разделов!";
echo"</div>";
}
if($account['status']=="gm"){
echo'<div style="text-align:left;padding:6px;color:#a5a5a5" class="menu_link3"><br></div>';
echo'<a href="forum.php?mod=razdel" class="menu_link"><img src="pic/main/pers_sohran.png" alt="" style="border:1px solid #131313;border-radius:2px;height:16px;width:16px"/> Добавить раздел</a>';
}
break;
case 'new_post':
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `id`='".intval($_GET['id'])."'"),0)){
$forum=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum` WHERE `id`='".intval($_GET['id'])."'"));
}else{
header('Location: forum.php?');
exit;
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_topik` WHERE `id`='".intval($_GET['topik'])."'"),0)){
$topik=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_topik` WHERE `id`='".intval($_GET['topik'])."'"));
}else{
header('Location: forum.php?');
exit;
}
$faq = mysql_query("SELECT * FROM `config`");
$base = mysql_fetch_array($faq);
if($account[lvl]<$base[forum_mail]){
echo'<div class="text">';
echo '<img src='pic/main/!.png'> <font color=00CC00>Писать сообщения на форуме доступно с '.$base[forum_mail].' уровня.</font></div>';
include 'inc/nogi.php';
exit;
}
if($topik[status]==1){
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].'');
exit;
}
$req = mysql_query("SELECT * FROM `block` WHERE `usr`='$account[id]' and `ban_time`>'$time' and `tip` = '1' ");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto>=1){
While($mag = mysql_fetch_array($req))
{
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].'');
exit;
}}
$msg=htmlspecialchars($_POST[msg]);
if(mb_strlen($msg) < 3)
{
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].'');
exit;
}
if(empty($msg)){
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].'');
exit;
}
include ("inc/antireklama.php");
$time = date("H:i d.m.y");
mysql_query("INSERT INTO `forum_msg` SET `topik` = '$topik[razdel]',`tema`='$topik[id]',`msg` = '$msg',`user` = '$account[id]',`time` = '$time' ");
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].'');
break;
case 'razdel':
echo'<div class="text2">';
if($account['status']=="gm"){
if(empty($_POST[name])){
echo "<form action="forum.php?mod=razdel" method="post">";
echo"Название раздела:<br><input class='input' type="text" size="25" name="name" maxlength="25"/><br>";
echo '<input class="button" type="submit" value="Создать" /></form></div>';
}else{
$msg=htmlspecialchars($_POST[name]);
if(mb_strlen($msg) < 5)
{
header ("Location: forum.php?mod=razdel"); exit;
exit;
}
mysql_query("INSERT INTO `forum` SET `name` = '$msg'");
header ("Location: forum.php?"); exit;
}
}else{
header ("Location: forum.php"); exit;
}
break;
case 'redakt':
if ($account['status']=='moder' OR $account['status']=='gm'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_topik` WHERE `id`='".intval($_GET['topik'])."'"),0)){
$forum=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_topik` WHERE `id`='".intval($_GET['topik'])."'"));
}else{
header('Location: forum.php?');
exit;
}
$topik=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_topik` WHERE `id`='".intval($_GET['topik'])."'"));
$forum=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum` WHERE `id`='".intval($_GET['ids'])."'"));
echo'<div class="menudiv">Редактирование топика</div><div class="separ2"></div>';
echo'<div class="text2">';
if(empty($_POST[tema])){
echo 'Название статьи:<br>';
echo '<form action="forum.php?mod=redakt&id2='.intval($forum['id']).'&topik='.intval($_GET['topik']).'&id='.intval($_GET['topik']).'" method="post">';
echo '<textarea name="tema" cols="30" rows="1">'.$topik[tema].'</textarea>';
echo '<br><input class="button" type="submit" value="Сохранить" /></form>';
}else{
$msg=htmlspecialchars($_POST[tema]);
$time = date("d.m.y в H:i:s");
mysql_query("UPDATE `forum_topik` SET `tema`='$msg' WHERE `id`='".intval($_GET['topik'])."'");
header('Location: forum.php?mod=post&id='.intval($_GET['id2']).'&topik='.$topik[id].'');
}
}else{
header ("Location: forum.php"); exit;
}
echo '</div>';
break;
case 'theme':
echo'<div class="text2">';
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `id`='".intval($_GET['id'])."'"),0)){
$forum=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum` WHERE `id`='".intval($_GET['id'])."'"));
}else{
header('Location: forum.php?');
exit;
}
echo "<img src="pic/main/forum.png"> <a href="forum.php">Форум</a> / $forum[name]<div class='separ2'></div>";
$cop=10;
$ca=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_topik` WHERE `razdel`='$forum[id]' "),0);
$cp=ceil($ca/$cop);
if(isset($_GET['page']) && is_numeric($_GET['page'])){
$page = $_GET['page'];
if($_GET['page']>$cp) $page=$cp;
if($_GET['page']<1)$page=1;
}else{
$page=1;
}
$start=$page*$cop-$cop;
$dlist = 'list1';
$req = mysql_query("SELECT * FROM `forum_topik` WHERE `razdel`='$forum[id]' ORDER by `id` DESC LIMIT $start,$cop ");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto>=1){
While($mag = mysql_fetch_array($req))
{
$w=explode("*",$mag[name]);
$kolic = mysql_query("SELECT COUNT(`msg`) FROM `forum_msg` WHERE `topik`='$mag[razdel]' and `tema`='$mag[id]';");
$kols = mysql_result($kolic, 0);
if($mag[status]==0){
echo"<img src="pic/main/forum_2.png"> <a href="forum.php?mod=post&id=$forum[id]&topik=$mag[id]">$mag[tema]</a> ($kols)";
}else{
echo"<img src="pic/main/forum_3.png"> <a href="forum.php?mod=post&id=$forum[id]&topik=$mag[id]">$mag[tema]</a> ($kols)";
}
if($_GET['go']=='delete' && ($account['status']=="moder" || $account['status']=="gm")){
if(isset($_GET['ids'])){
$del = $_GET['ids'];
}
if($del){
mysql_query("DELETE FROM `forum_msg` WHERE `tema`='".$del."'");
mysql_query("DELETE FROM `forum_topik` WHERE `id`='".$del."'");
mysql_query("DELETE FROM `forum_rating` WHERE `topik`='".$del."'");
mysql_query("DELETE FROM `forum_golos` WHERE `topik`='".$del."'");
mysql_query("UPDATE `forum` SET `tem`=`tem` - '1' WHERE `id`='$forum[id]'");
header('Location: forum.php?mod=theme&id='.$forum[id].''); exit;
}else{
header('Location: forum.php?mod=theme&id='.$forum[id].''); exit;
}}
if ($account['status']=='moder' OR $account['status']=='gm'){
echo ' (<a href="forum.php?mod=redakt&ids='.$forum[id].'&topik='.$mag[id].'">Редактировать</a>) (<a href="forum.php?mod=theme&go=delete&id='.$forum[id].'&ids='.$mag[id].'">Удалить</a>)';
}
echo ' <br>';
}
echo '
<div class="separ2"></div>
<center>
Навигация:
';if($page-1>0){
echo ' <a href="forum.php?mod=theme&id='.$forum[id].'&page='.($page-1).'"><</a> ';
}
if($page-1>0){
echo ' <a href="forum.php?mod=theme&id='.$forum[id].'&page='.($page-1).'">'.($page-1).'</a> ';
}
echo '<b>'.$page.'</b>';
if($page+1<=$cp){
echo ' <a href="forum.php?mod=theme&id='.$forum[id].'&page='.($page+1).'">'.($page+1).'</a> ';
}
if($page+1<=$cp){
echo ' <a href="forum.php?mod=theme&id='.$forum[id].'&page='.($page+1).'">></a> ';
}
echo '</center>';
}else{echo "<img src="pic/main/!.png"> В данном разделе пока нет топиков.<br>";}
echo '</div><br />';
echo '<center>';
echo '<a href="forum.php?mod=topik&id='.$forum[id].'" class="menu_j"><img src="pic/main/pers_sohran.png" alt="" style="border:1px solid #131313;border-radius:2px;height:16px;width:16px"/> Создать топик</a>';
break;
case 'topik':
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `id`='".intval($_GET['id'])."'"),0)){
$forum=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum` WHERE `id`='".intval($_GET['id'])."'"));
}else{
header('Location: forum.php?');
exit;
}
echo'<div class="text2">';
echo "<img src="pic/main/forum.png"> <a href="forum.php">Форум</a> / <a href="forum.php?mod=theme&id=$forum[id]">$forum[name]</a><div class='separ2'></div>";
if($account['status']=="user" && ($forum['id']=="1")){
echo'<div class="text2">';
echo '<img src='pic/main/!.png'><font color=00CC00> Создавать топики в данном разделе может только администратор.</font></div>';
include 'inc/nogi.php';
exit;
}
if($account['status']=="moder" && ($forum['id']=="1")){
echo'<div style="text-align:left;padding:6px;color:#a5a5a5" class="menu_link3">';
echo '<img src='pic/main/!.png'><font color=00CC00> Создавать топики в данном разделе может только администратор.</font></div>';
include 'inc/nogi.php';
exit;
}
$faq = mysql_query("SELECT * FROM `config`");
$base = mysql_fetch_array($faq);
if($account[lvl]<$base[forum]){
echo'<div style="text-align:left;padding:6px;color:#a5a5a5" class="menu_link3">';
echo '<img src='pic/main/!.png'><font color=00CC00> Создавать темы на форуме доступно с '.$base[forum].' уровня.</font></div>';
include 'inc/nogi.php';
exit;
}
if (('chat_clear') && isset($_GET['act']) && $_GET['act']=='clear1')
{
echo"<img src="pic/main/!.png"><font color=00CC00> Введите название топика!</font><div class='separ2'></div>";
}
if (('chat_clear') && isset($_GET['act']) && $_GET['act']=='clear2')
{
echo"<img src="pic/main/!.png"><font color=00CC00> Название топика может содержать от 3, до 50-ти рус. или латин. символов.</font><div class='separ2'></div>";
}
if (('chat_clear') && isset($_GET['act']) && $_GET['act']=='clear3')
{
echo"<img src="pic/main/!.png"><font color=00CC00> Введите текст сообщения.</font><div class='separ2'></div>";
}
if (('chat_clear') && isset($_GET['act']) && $_GET['act']=='clear4')
{
echo"<img src="pic/main/!.png"><font color=00CC00> Длина сообщения может содержать от 10 до 5,000-ти рус. или латин. символов.</font><div class='separ2'></div>";
}
echo '<form name="form" action="forum.php?mod=topik_yes&id='.$forum[id].'" method="post">';
echo "Название топика:<br><small><font color='#999999'><i><font color=00CC00>* Название топика может содержать от 3, до 50-ти рус. или латин. символов.</font></i></font></small><br/>";
echo "<input class="button" type="text" name="nazva" maxlength="50" title="Название темы" emptyok="true"/>";
echo "<br/>Текст сообщения:<br><small><font color='#999999'><i><font color=00CC00>* Длина сообщения может содержать от 10 до 5,000-ти рус. или латин. символов.</font></i></font></small><br/>";
echo ''.bbpanel('form', 'msg').'<textarea name="msg" cols="20" rows="3"></textarea><br>
<input class="button" type="submit" value="Создать"/></form></div>';
break;
case 'topik_yes':
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `id`='".intval($_GET['id'])."' "),0)){
$forum=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum` WHERE `id`='".intval($_GET['id'])."'"));
}else{
header('Location: forum.php?');
exit;
}
$nazva=htmlspecialchars($_POST[nazva]);
$msg=htmlspecialchars($_POST[msg]);
if(mb_strlen($nazva) < 3)
{
header("Location: forum.php?mod=topik&id=$forum[id]&act=clear1");
exit;
}
if(mb_strlen($nazva) > 50)
{
header("Location: forum.php?mod=topik&id=$forum[id]&act=clear2");
exit;
}
if(empty($msg)){
header("Location: forum.php?mod=topik&id=$forum[id]&act=clear3");
exit;
}
if(mb_strlen($msg) > 5000)
{
header("Location: forum.php?mod=topik&id=$forum[id]&act=clear4");
exit;
}
$time = date("H:i d.m.y");
mysql_query("INSERT INTO `forum_topik` SET `razdel` = '$forum[id]',`tema` = '$nazva',`user` = '$account[id]' ");
$u=mysql_query("SELECT * FROM `forum_topik` ORDER by `id` DESC");
$dat=mysql_fetch_array($u);
$uids=$dat[id];
include ("inc/antireklama.php");
mysql_query("INSERT INTO `forum_msg` SET `topik` = '$forum[id]',`tema`='$uids',`msg` = '$msg',`user` = '$account[id]',`time` = '$time' ");
mysql_query("UPDATE `forum` SET `tem`=`tem` + '1' WHERE `id`='$forum[id]'");
header('Location: forum.php?mod=theme&id='.$forum[id].'');
break;
case 'post':
echo'<div class="text2">';
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `id`='".intval($_GET['id'])."'"),0)){
$forum=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum` WHERE `id`='".intval($_GET['id'])."'"));
}else{
header('Location: forum.php?');
exit;
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_topik` WHERE `id`='".intval($_GET['topik'])."'"),0)){
$topik=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_topik` WHERE `id`='".intval($_GET['topik'])."'"));
}else{
header('Location: forum.php?');
exit;
}
$topiks=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_msg` WHERE `topik`='".intval($_GET['topik'])."' ORDER by `id` DESC LIMIT 1 "));
echo "<img src="pic/main/forum.png"> <a href="forum.php">Форум</a> / <a href="forum.php?mod=theme&id=$forum[id]">$forum[name]</a> / $topik[tema]";
if($_GET['go']=='cloze' && ($topik['user']=="$account[id]")){
if(isset($_GET['topik'])){
$del = $_GET['topik'];
}
if($del){
mysql_query("UPDATE `forum_topik` SET `status`='1' WHERE `id`='".$del."'");
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].''); exit;
}else{
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].''); exit;
}
}
if($_GET['go']=='yes' && ($topik['user']=="$account[id]")){
if(isset($_GET['topik'])){
$del = $_GET['topik'];
}
if($del){
mysql_query("UPDATE `forum_topik` SET `status`='0' WHERE `id`='".$del."'");
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].''); exit;
}else{
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].''); exit;
}}
if($_GET['go']=='up_minus'){
if($topik[status]==1){
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].''); exit;
}else{
$req = mysql_query("SELECT * FROM `forum_rating` WHERE `account`='$account[id]' and `ids`='$forum[id]' and `topik`='$topik[id]' ");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto==0){
mysql_query("UPDATE `forum_topik` SET `rating_minus`=`rating_minus` + '1' WHERE `id`='$topik[id]'");
mysql_query("INSERT INTO `forum_rating` SET `account` = '$account[id]', `ids` = '$forum[id]', `topik` = '$topik[id]'");
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].''); exit;
}else{
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].''); exit;
}
}}
if($_GET['go']=='up_plus'){
if($topik[status]==1){
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].''); exit;
}else{
$req = mysql_query("SELECT * FROM `forum_rating` WHERE `account`='$account[id]' and `ids`='$forum[id]' and `topik`='$topik[id]' ");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto==0){
mysql_query("UPDATE `forum_topik` SET `rating_plus`=`rating_plus` + '1' WHERE `id`='$topik[id]'");
mysql_query("INSERT INTO `forum_rating` SET `account` = '$account[id]', `ids` = '$forum[id]', `topik` = '$topik[id]'");
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].''); exit;
}else{
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].''); exit;
}
}}
if($topik[user]==$account[id]){
if($topik[status]==0){
echo " / <a href="forum.php?mod=post&go=cloze&id=$forum[id]&topik=$topik[id]"><font color=red>Закрыть топик</font></a>";
}else{
echo " / <a href="forum.php?mod=post&go=yes&id=$forum[id]&topik=$topik[id]"><font color=red>Открыть топик</font></a>";
}}
echo '<div class="separ2"></div>';
echo '<center>(Прочитано: '.$topik[proc].' | Рейтинг: ';
$req = mysql_query("SELECT * FROM `forum_rating` WHERE `account`='$account[id]' and `ids`='$forum[id]' and `topik`='$topik[id]' ");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto==0){
echo '<a href="forum.php?mod=post&go=up_plus&id='.$forum[id].'&topik='.$topik[id].'"><img src="/pic/main/plusa.png" alt="*"/></a> ';
}else{
echo '<img src="/pic/main/plusa.png" alt="*"/> ';
}
echo '<font color=lime>'.$topik[rating_plus].'</font> ';
$req = mysql_query("SELECT * FROM `forum_rating` WHERE `account`='$account[id]' and `ids`='$forum[id]' and `topik`='$topik[id]' ");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto==0){
echo '<a href="forum.php?mod=post&go=up_minus&id='.$forum[id].'&topik='.$topik[id].'"><img src="/pic/main/minus.png" alt="*"/></a> ';
}else{
echo '<img src="/pic/main/minus.png" alt="*"/> ';
}
echo '<font color=red>'.$topik[rating_minus].'</font>)</center>';
echo '<div class="separ2"></div>';
if ($_GET['say']){
$say=mysql_result(mysql_query("SELECT `login` FROM `account` WHERE `id`='".intval($_GET['say'])."'"),0);
$say = str_replace("$say","$say, ",$say);
}else{
$say='';
}
if($topik[status]==0){
echo '<form name="form" action="forum.php?mod=new_post&id='.$forum[id].'&topik='.$topik[id].'" method="post">'.bbpanel('form', 'msg').'<script type="text/javascript">
function ctrlEnter(event, formElem)
{
if((event.ctrlKey) && ((event.keyCode == 0xA)||(event.keyCode == 0xD)))
{
formElem.form.submit();
}
}
</script>
<textarea name="msg" style="width:35%;resize:vertical;" placeholder="Введите сообщение..." rows="2" onkeypress="ctrlEnter(event, this);">'.$say.'</textarea><br>
<input type="submit" class="submit" value="Отпр.">
</form>
<div class="separ2"></div>
';
}else{
echo "<img src="pic/main/!.png"> <font color=red><b>Топик закрыт!</b></b></font><div class='separ2'></div>";
}
$g=mysql_query("SELECT * FROM `forum_topik` WHERE `razdel`='$forum[id]' AND `id`='$topik[id]' LIMIT 1");
if(mysql_num_rows($g)==1){
$cop=10;
$ca=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_msg` WHERE `topik`='$forum[id]' AND `tema`='$topik[id]' "),0);
$cp=ceil($ca/$cop);
if(isset($_GET['page']) && is_numeric($_GET['page'])){
$page = $_GET['page'];
if($_GET['page']>$cp) $page=$cp;
if($_GET['page']<1)$page=1;
}else{
$page=1;
}
$start=$page*$cop-$cop;
$dlist = 'list1';
$qi = mysql_query("SELECT * FROM `forum_msg` WHERE `topik`='$forum[id]' AND `tema`='$topik[id]' ORDER by `id` DESC LIMIT $start,$cop");
while($row=mysql_fetch_array($qi))
{
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$req = mysql_query("SELECT * FROM `forum_golos` WHERE `account`='$account[id]' and `ids`='$forum[id]' and `topik`='$topik[id]' ");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto==0){
mysql_query("UPDATE `forum_topik` SET `proc`=`proc` + '1' WHERE `id`='$topik[id]'");
mysql_query("INSERT INTO `forum_golos` SET `account` = '$account[id]', `ids` = '$forum[id]', `topik` = '$topik[id]'");
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].''); exit;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Голоса за топик
$req1 = mysql_query("SELECT `id`,`status`,`login`,`sex`,`last_active` FROM `account` WHERE `id` = '".$row['user']."'");
$_user = mysql_fetch_array($req1);
if($_user['status']=="gm"){
$nik = gradient(''.$_user[login].'','00FF00', '00CC00');
echo '<us><img src="pic/main/'.$_user[sex].'.png" alt="*"/> <a href="forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].'&say='.$row['user'].'">'.$nik.'</a></us> <a href="infa.php?id='.$_user['id'].'"><img src="/pic/main/info.gif" alt="*"/></a>';
$d = time()-7000;
if($_user[last_active]<$d){echo" - <font color=red>Offline</font>";
}else{
echo" - <font color=00CC00>Online</font>";
}
}else{
if($_user['status']=="moder"){
$nik = gradient(''.$_user[login].'','0066CC', 'AB82FF');
echo '<us><img src="pic/main/'.$_user[sex].'.png" alt="*"/> <a href="forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].'&say='.$row['user'].'">'.$nik.'</a></us> <a href="infa.php?id='.$_user['id'].'"><img src="/pic/main/info.gif" alt="*"/></a>';
$d = time()-7000;
if($_user[last_active]<$d){echo" - <font color=red>Offline</font>";
}else{
echo" - <font color=00CC00>Online</font>";
}
}else{
if($_user['status']=="bot"){
$nik = gradient(''.$_user[login].'','FFCC00', 'FF9933');
echo '<us><img src="pic/main/'.$_user[sex].'.png" alt="*"/> <a href="forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].'&say='.$row['user'].'">'.$nik.'</a></us> <a href="infa.php?id='.$_user['id'].'"><img src="/pic/main/info.gif" alt="*"/></a>';
$d = time()-7000;
if($_user[last_active]<$d){echo" - <font color=red>Offline</font>";
}else{
echo" - <font color=00CC00>Online</font>";
}
}else{
echo '
<img src="pic/main/'.$_user[sex].'.png" alt="*"/> <a href="forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].'&say='.$row['user'].'">'.$_user['login'].'</a> <a href="infa.php?id='.$_user['id'].'"><img src="/pic/main/info.gif" alt="*"/></a>';
$d = time()-7000;
if($_user[last_active]<$d){echo" - <font color=red>Offline</font>";
}else{
echo" - <font color=00CC00>Online</font>";
}
}}
}
echo ' <font color=00CC00><img src="pic/main/timereg.png" alt="*"/> (<small>'.$row[time].'</small>)</font>';
if($_GET['go']=='delete' && ($account['status']=="moder" || $account['status']=="gm")){
if(isset($_GET['del'])){
$del = $_GET['del'];
}
if($del){
mysql_query("DELETE FROM `forum_msg` WHERE `id`='".$del."'");
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].''); exit;
}else{
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].''); exit;
}}
if ($account['status']=='moder' OR $account['status']=='gm'){
echo ' <a href="forum.php?mod=post&go=delete&id='.$forum[id].'&topik='.$topik[id].'&del='.$row['id'].'"><img src='pic/main/!.png'></a>';
}
echo '<br>';
$koment = strip_tags($row['msg']);
$koment = smiles(tags($koment));
if($topik[tip]==1){
echo ''.$row[msg].'';
}else{
if($_user[status]=="gm"){
echo "<font color=LightCoral>";
echo bb($koment);
echo "</font>";
}
if($_user[status]=="moder"){
echo "<font color=#1E90FF>";
echo bb($koment);
echo "</font>";
}
if($_user[status]=="bot"){
echo "<font color=gold>";
echo bb($koment);
echo "</font>";
}
if($_user[status]=="user"){
echo bb($koment);
}
}
echo '<div class="separ2"></div>';
}
echo '
<center>
Навигация:
';if($page-1>0){
echo '<a href="forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].'&page='.($page-1).'"><</a> ';
}
if($page-1>0){
echo ' <a href="forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].'&page='.($page-1).'">'.($page-1).'</a> ';
}
echo '<b>'.$page.'</b>';
if($page+1<=$cp){
echo ' <a href="forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].'&page='.($page+1).'">'.($page+1).'</a> ';
}
if($page+1<=$cp){
echo ' <a href="forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].'&page='.($page+1).'">></a> ';
}
echo '</center>';
}
if($_GET['go']=='cloze_elita' && ($account['status']=="moder" || $account['status']=="gm")){
if(isset($_GET['topik'])){
$del = $_GET['topik'];
}
if($del){
mysql_query("UPDATE `forum_topik` SET `status`='1' WHERE `id`='".$del."'");
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].''); exit;
}else{
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].''); exit;
}}
if($_GET['go']=='yes_elita' && ($account['status']=="moder" || $account['status']=="gm")){
if(isset($_GET['topik'])){
$del = $_GET['topik'];
}
if($del){
mysql_query("UPDATE `forum_topik` SET `status`='0' WHERE `id`='".$del."'");
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].''); exit;
}else{
header('Location: forum.php?mod=post&id='.$forum[id].'&topik='.$topik[id].''); exit;
}}
echo '</div><div class="separ2"></div>';
if ($account['status']=='moder' OR $account['status']=='gm'){
if($topik[status]==0){
echo'<a href="forum.php?mod=post&go=cloze_elita&id='.$forum[id].'&topik='.$topik[id].'" class="menu_link"><img src="pic/main/!.png" alt="" style="border:1px solid #131313;border-radius:2px;height:16px;width:16px"/> Закрыть топик</a>';
}else{
echo'<a href="forum.php?mod=post&go=yes_elita&id='.$forum[id].'&topik='.$topik[id].'" class="menu_link"><img src="pic/main/pers_sohran.png" alt="" style="border:1px solid #131313;border-radius:2px;height:16px;width:16px"/> Открыть топик</a>';
}}
}
}else{
header ("Location: index.php"); exit;
}
include 'inc/nogi.php';
?>