Файл: modules/forum/index.php
Строк: 1486
<?php
include '../../system/core.php';
include '../../system/header.php';
///////бан форума/////
if($user['id'])
{
$banf = mysql_fetch_assoc(mysql_query("SELECT * FROM `ban_forum` WHERE `who` = '".$user['id']."'"));
if($banf['end'] > time())
{
echo "<a href='/'><div class='logo'><img src='/images/cornerhat.png' class='snoww'><span style='font-family: drunkC; font-size:22px;'>Доступ к форуму ограничен</span></div> </a>";
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
echo '<div class="post2">
Ограничил к доступу: '.ustatus($banf['ho']).' <b>'.uname($banf['ho']).'</b> '.uaccess($banf['ho']).'<br>
Причина: <b>'.smiles(bbcode($banf['why'])).'</b><br>
Дата бана по форуму: <b>'.times($banf['time']).'</b><br>
Дата освобождения: <b>'.date('d.m.Y в H:i',$banf['end']).'</b>
</div>';
include '../../system/footer.php';
exit;
}
}
//////////////бан форума///////////
/////////////переадресация если не авториз.//////
if(!$user['id'])
{
header('Location: /index.php/?m=guest');
exit;
}
/////////////переадресация если не авториз.//////
/////////////голосования .//////
switch($_GET['m'])
{
case 'vote':
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id)){
header('Location: /forum'); exit;
}
$forum_t = mysql_fetch_array(mysql_query('select * from `forum_t` where `id` = "'.$id.'"'));
$forum_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$forum_t['pr'].'"'));
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$forum_pr['r'].'"'));
if($forum_t == 0 or $forum_pr == 0 or $forum_r == 0 or $user['status'] < 1 && $user['id'] != $forum_t['author']){
header('Location: /forum'); exit;
}
$forum_vote = mysql_fetch_array(mysql_query('select * from `forum_vote` where `t` = "'.$id.'" limit 1'));
if($forum_vote != 0){
mysql_query("DELETE FROM `forum_vote` WHERE `id` = '".$forum_vote['id']."'");
header('Location: /forum/t'.$id.'');
}else{
echo "<a href='/forum/t".$id."'><div class='logo'><img src='/images/cornerhat.png' class='snoww'><span style='font-family: drunkC; font-size:22px;'>Добавление опроса</span></div> </a>";
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
if(isset($_POST['submit'])){
$quest = TextGuard($_POST['quest']);
if(empty($quest)) $err[] = 'Введите вопрос.';
$select_1 = TextGuard($_POST['select_1']);
if(empty($select_1)) $select_1_p = 0; else $select_1_p = 1;
$select_2 = TextGuard($_POST['select_2']);
if(empty($select_2)) $select_2_p = 0; else $select_2_p = 1;
$select_3 = TextGuard($_POST['select_3']);
if(empty($select_3)) $select_3_p = 0; else $select_3_p = 1;
$select_4 = TextGuard($_POST['select_4']);
if(empty($select_4)) $select_4_p = 0; else $select_4_p = 1;
$select_5 = TextGuard($_POST['select_5']);
if(empty($select_5)) $select_5_p = 0; else $select_5_p = 1;
$selects = $select_1_p+$select_2_p+$select_3_p+$select_4_p+$select_5_p;
if($selects < 2) $err[] = 'Для создания голосования нужно указать как минимум 2 варианта ответа.';
if(!$err){
mysql_query("INSERT INTO `forum_vote`(
`t`,`quest`,`select_1`,`select_2`,`select_3`,`select_4`,`select_5`
)VALUES(
'".$id."','".$quest."','".$select_1."','".$select_2."','".$select_3."','".$select_4."','".$select_5."'
)");
header('Location: /forum/t'.$id.''); exit;
}else{
echo '<div class="err">';
foreach($err as $err_info){
echo $err_info.'<br>';
}
echo '</div>';
}
}
echo '<div class="glav">
<form action="" method="post">
Вопрос:<br><input name="quest"/><br>
Вариант 1:<br><input name="select_1"/><br>
Вариант 2:<br><input name="select_2"/><br>
Вариант 3:<br><input name="select_3"/><br>
Вариант 4:<br><input name="select_4"/><br>
Вариант 5:<br><input name="select_5"/><br>
<input type="submit" value="Добавить" name="submit"/>
</form></div>';
}
break;
/////////////голосования .//////
/////////////кто голосовал .//////
case 'vote_members':
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id)){
header('Location: /forum'); exit;
}
$forum_t = mysql_fetch_array(mysql_query('select * from `forum_t` where `id` = "'.$id.'"'));
$forum_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$forum_t['pr'].'"'));
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$forum_pr['r'].'"'));
if($forum_t == 0 or $forum_pr == 0 or $forum_r == 0){
header('Location: /forum'); exit;
}
$forum_vote = mysql_fetch_array(mysql_query('select * from `forum_vote` where `t` = "'.$id.'" limit 1'));
if($forum_vote == 0){
header('Location: /forum/t'.$id.'');
}
echo "<a href='/forum/t".$id."'><div class='logo'><img src='/images/cornerhat.png' class='snoww'><span style='font-family: drunkC; font-size:22px;'>Кто голосовал?</span></div> </a>";
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
$cop = $user['on_page'];
$ca = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_t` WHERE `pr`='".$id."'"),0);
$cp = ceil($ca/$cop);
if(isset($_GET['p']) && is_numeric($_GET['p'])){
$p = $_GET['p'];
if($_GET['p']>$cp) $p = $cp;
if($_GET['p']<1)$p = 1;
}else{
$p = 1;
}
$start = $p*$cop-$cop;
$forum_votes = mysql_query("SELECT * FROM `forum_votes` WHERE `vote`='".$forum_vote['id']."' ORDER BY `id` desc LIMIT $start,$cop");
while($forum_votes2 = mysql_fetch_assoc($forum_votes)){
echo '<div class="post2">'.ustatus($forum_votes2['who']).' <a href="/us'.$forum_votes2['who'].'">'.uname($forum_votes2['who']).'</a> '.uaccess($forum_votes2['who']).' проголосовал за <b>'.$forum_vote['select_'.$forum_votes2['select']].'</b></div>';
}
echo '<div class="spis">Стр. ';
if($p-2>0) echo '<a href="/forum/t'.$id.'/vote_members?p=1"><<</a> ';
if($p-1>0) echo '<a href="/forum/t'.$id.'/vote_members?p='.($p-1).'"><</a> ';
if($p-3>0) echo '<a href="/forum/t'.$id.'/vote_members?p=1'.($p-3).'">'.($p-3).'</a> | ';
if($p-2>0) echo '<a href="/forum/t'.$id.'/vote_members?p=1'.($p-2).'">'.($p-2).'</a> | ';
if($p-1>0) echo '<a href="/forum/t'.$id.'/vote_members?p=1'.($p-1).'">'.($p-1).'</a> | ';
echo '<b>'.$p.'</b>';
if($p+1<=$cp) echo ' | <a href="/forum/t'.$id.'/vote_members?p=1'.($p+1).'">'.($p+1).'</a>';
if($p+2<=$cp) echo ' | <a href="/forum/t'.$id.'/vote_members?p=1'.($p+2).'">'.($p+2).'</a>';
if($p+3<=$cp) echo ' | <a href="/forum/t'.$id.'/vote_members?p=1'.($p+3).'">'.($p+3).'</a>';
if($p+1<=$cp) echo ' <a href="/forum/t'.$id.'/vote_members?p=1'.($p+1).'">></a>';
if($p+2<=$cp) echo ' <a href="/forum/t'.$id.'/vote_members?p=1'.ceil($ca/$cop).'">>></a>';
echo '</div>';
break;
/////////////кто голосовал .//////
/////////////Новый раздел .//////
case 'nr':
if($user['status'] < 2){
header('Location: /forum'); exit;
}
echo "<a href='/'><div class='logo'><img src='/images/cornerhat.png' class='snoww'><span style='font-family: drunkC; font-size:22px;'>Добавление раздела</span></div> </a>";
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
if(isset($_POST['submit'])){
$name = TextGuard($_POST['name']);
if(!$err){
mysql_query("INSERT INTO `forum_r`(
`name`
)VALUES(
'".$name."'
)");
header('Location: ?'); exit;
}else{
echo '<div class="err">';
foreach($err as $err_info){
echo $err_info.'<br>';
}
echo '</div>';
}
}
echo '<div class="glav">
<form action="?m=nr" method="post">
Название:<br><input name="name"/><br>
<input type="submit" value="Добавить" name="submit"/>
</form></div>';
break;
/////////////новый раздел .//////
/////////////удаление раздела .//////
case 'dr':
if($user['status'] < 2){
header('Location: /forum'); exit;
}
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id)){
header('Location: ?'); exit;
}
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$id.'"'));
if($forum_r == 0){
header('Location: ?'); exit;
}
$forum_pr = mysql_query('select * from `forum_pr` where `r` = "'.$id.'"');
while($forum_pr2 = mysql_fetch_array($forum_pr)){
mysql_query("DELETE FROM `forum_pr` WHERE `id` = '".$forum_pr2['id']."'");
}
$forum_t = mysql_query('select * from `forum_t` where `r` = "'.$id.'"');
while($forum_t2 = mysql_fetch_array($forum_t)){
mysql_query("DELETE FROM `forum_t` WHERE `id` = '".$forum_t2['id']."'");
}
$forum_m = mysql_query('select * from `forum_m` where `r` = "'.$id.'"');
while($forum_m2 = mysql_fetch_array($forum_m)){
mysql_query("DELETE FROM `forum_m` WHERE `id` = '".$forum_m2['id']."'");
}
mysql_query("DELETE FROM `forum_r` WHERE `id` = '$id'");
header('Location: ?'); exit;
break;
/////////////удаление раздела .//////
/////////////новый подраздел .//////
case 'npr':
if($user['status'] < 2){
header('Location: /forum'); exit;
}
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id)){
header('Location: ?'); exit;
}
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$id.'"'));
if($forum_r == 0){
header('Location: ?'); exit;
}
echo "<a href='/'><div class='logo'><img src='/images/cornerhat.png' class='snoww'><span style='font-family: drunkC; font-size:22px;'>Добавление подраздела</span></div> </a>";
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
if(isset($_POST['submit'])){
$name = TextGuard($_POST['name']);
if(empty($name)) $err[] = 'Название осталось пустым...';
$rul = TextGuard($_POST['rul']);
if(empty($rul)) $err[] = 'Правила остались пустыми...';
if(!$err){
mysql_query("INSERT INTO `forum_pr`(
`r`,
`name`
)VALUES(
'".$id."',
'".$name."'
)");
$pr_id = mysql_insert_id();
mysql_query("INSERT INTO `forum_pr_rules`(
`pr`,
`text`
)VALUES(
'".$pr_id."',
'".$rul."'
)");
header('Location: /forum/r'.$id.''); exit;
}else{
echo '<div class="err">';
foreach($err as $err_info){
echo $err_info.'<br>';
}
echo '</div>';
}
}
echo '<div class="glav">
<form action="?m=npr&id='.$id.'" method="post">
Название:<br><input name="name"/><br>
Правила раздела:<br><textarea name="rul" style="width:98%;" rows="3"></textarea><br>
<input type="submit" value="Добавить" name="submit"/>
</form></div>';
break;
/////////////новый подраздел .//////
/////////////удаление подраздела .//////
case 'dpr':
if($user['status'] < 2){
header('Location: /forum'); exit;
}
$pr = TextGuard($_GET['pr']);
if(empty($pr) or !is_numeric($pr)){
header('Location: ?'); exit;
}
$forum_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$pr.'"'));
if($forum_pr == 0){
header('Location: /forum'); exit;
}
$forum_t = mysql_query('select * from `forum_t` where `pr` = "'.$pr.'"');
while($forum_t2 = mysql_fetch_array($forum_t)){
mysql_query("DELETE FROM `forum_t` WHERE `id` = '".$forum_t2['id']."'");
}
$forum_m = mysql_query('select * from `forum_m` where `pr` = "'.$pr.'"');
while($forum_m2 = mysql_fetch_array($forum_m)){
mysql_query("DELETE FROM `forum_m` WHERE `id` = '".$forum_m2['id']."'");
}
mysql_query("DELETE FROM `forum_pr` WHERE `id` = '$pr'");
mysql_query("DELETE FROM `forum_pr_rules` WHERE `pr` = '$pr'");
header('Location: /forum/r'.$id.''); exit;
break;
/////////////удаление подраздела .//////
/////////////редактирование раздел .//////
case 'er':
if($user['status'] < 2){
header('Location: /forum'); exit;
}
$id = TextGuard($_GET['id']);
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$id.'" limit 1'));
if(empty($id) or !is_numeric($id) or $forum_r == 0){
header('Location: /forum'); exit;
}
echo "<a href='/'><div class='logo'><img src='/images/cornerhat.png' class='snoww'><span style='font-family: drunkC; font-size:22px;'>Редактирование раздела</span></div> </a>";
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
if(isset($_POST['submit'])){
$text = TextGuard($_POST['text']);
if(empty($text)) $err[] = 'Название осталось пустым...';
if(!$err){
mysql_query("UPDATE `forum_r` SET `name`='".$text."' WHERE `id` = '".$id."' limit 1");
header('Location: /forum'); exit;
}else{
echo '<div class="err">';
foreach($err as $err_info){
echo $err_info.'<br>';
}
echo '</div>';
}
}
echo '<div class="glav">
<form action="/forum?m=er&id='.$id.'" method="post">
Название:<br><input name="text" value="'.$forum_r['name'].'"/><br>
<input type="submit" value="Сохранить" name="submit"/>
</form></div>';
break;
/////////////редактирование раздела .//////
/////////////редактирование подраздела .//////
case 'epr':
if($user['status'] < 2){
header('Location: /forum'); exit;
}
$id = TextGuard($_GET['id']);
$forum_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$id.'" limit 1'));
if(empty($id) or !is_numeric($id) or $forum_pr == 0){
header('Location: /forum/r'.$forum_pr['r'].''); exit;
}
echo "<a href='/'><div class='logo'><img src='/images/cornerhat.png' class='snoww'><span style='font-family: drunkC; font-size:22px;'>Редактирование подраздела</span></div> </a>";
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
if(isset($_POST['submit'])){
$text = TextGuard($_POST['text']);
if(empty($text)) $err[] = 'Название осталось пустым...';
if(!$err){
mysql_query("UPDATE `forum_pr` SET `name`='".$text."' WHERE `id` = '".$id."' limit 1");
header('Location: /forum/r'.$forum_pr['r'].''); exit;
}else{
echo '<div class="err">';
foreach($err as $err_info){
echo $err_info.'<br>';
}
echo '</div>';
}
}
echo '<div class="glav">
<form action="/forum?m=epr&id='.$id.'" method="post">
Название:<br><input name="text" value="'.$forum_pr['name'].'"/><br>
<input type="submit" value="Сохранить" name="submit"/>
</form></div>';
break;
/////////////редактирование подраздела .//////
/////////////главная .//////
#Главная
default:
echo "<a href='/'><div class='logo'><img src='/images/cornerhat.png' class='snoww'><span style='font-family: drunkC; font-size:22px;'>Форум мастеров</span></div> </a>";
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
if($user['status'] >= 2) echo '<div class="post2">
<a href="?m=nr" ><b>Новый раздел</b></a></div>';
echo '<div class="post2">
<img src="/images/ttema.png"/> Темы: <a href="/us'.$user['id'].'?m=f_t">Мои</a> | <a href="">Новые</a> | <a href="">Обновленные</a><br>
<img src="/images/npost.png"/> Посты: <a href="/us'.$user['id'].'?m=f_m">Мои</a> | <a href="">Новые</a>
</div>';
$forum_r = mysql_query('select * from `forum_r` order by `id`');
while($forum_r2 = mysql_fetch_array($forum_r)){
echo '<div class="tegi"><img src="/images/global.png"/> <a href="/forum/r'.$forum_r2['id'].'" ><b>'.$forum_r2['name'].'</b></a> ('.mysql_result(mysql_query('select count(`id`) from `forum_t` where `r` = "'.$forum_r2['id'].'"'),0).'/'.mysql_result(mysql_query('select count(`id`) from `forum_m` where `r` = "'.$forum_r2['id'].'"'),0).')';
if($user['status'] >= 2) echo ' [<a href="?m=er&id='.$forum_r2['id'].'" >ред</a>] [<a href="?m=dr&id='.$forum_r2['id'].'" >уд</a>]';
echo '</div><div class="post2">';
$forum_pr = mysql_query('select * from `forum_pr` where `r` = "'.$forum_r2['id'].'" order by `id`');
while($forum_pr2 = mysql_fetch_array($forum_pr)){
echo '<img src="/images/tops.png"/> <a href="/forum/pr'.$forum_pr2['id'].'">'.$forum_pr2['name'].'</a> ('.mysql_result(mysql_query('select count(`id`) from `forum_t` where `r` = "'.$forum_r2['id'].'" and `pr` = "'.$forum_pr2['id'].'"'),0).'/'.mysql_result(mysql_query('select count(`id`) from `forum_m` where `r` = "'.$forum_r2['id'].'" and `pr` = "'.$forum_pr2['id'].'"'),0).')<br>';
}
echo '</div>';
$last = mysql_query('select * from `forum_t` where `r` = "'.$forum_r2['id'].'" order by `ltime` desc limit 1');
while($last2 = mysql_fetch_array($last)){
$last2_m = mysql_result(mysql_query('select count(`id`) from `forum_m` where `t` = "'.$last2['id'].'"'),0);
$last2_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$last2['pr'].'"'));
echo '<div class="post1">Подраздел: <a href="/forum/pr'.$last2_pr['id'].'">'.$last2_pr['name'].'</a><br>';
if($last2['check'] == 0){
if($last2['status'] == 0) echo '<img src="/modules/forum/images/the.png"/> '; else echo '<img src="/modules/forum/images/closed.png"/> ';
}else{
echo '<img src="/modules/forum/images/check.png"/> ';
}
echo '<a href="/forum/t'.$last2['id'].'">'.$last2['name'].'</a> ('.$last2_m.') <a href="/forum/t'.$last2['id'].'/p'.ceil(($last2_m+1)/10).'">></a><br>
<small>'.ustatus($last2['author']).' <a href="/us'.$last2['author'].'">'.uname($last2['author']).'</a> '.uaccess($last2['author']).'/'.ustatus($last2['last']).' <a href="/us'.$last2['last'].'">'.uname($last2['last']).'</a> '.uaccess($last2['last']).' ('.times($last2['ltime']).')</small></div>';
}
}
echo '
<div class="tegi"><img src="/modules/forum/images/emoc.png"/> <a href="/smiles.php" >Смайлы</a> | <img src="/modules/forum/images/cod.png"/> <a href="/bbcode.php" >ББ коды</a> | <img src="/modules/forum/images/usear.png"/> <a href="/forum/search" >Поиск</a></div>';
break;
/////////////главная .//////
/////////////раздел .//////
case 'r':
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id)){
header('Location: /forum'); exit;
}
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$id.'"'));
if($forum_r == 0){
header('Location: /forum'); exit;
}
echo "<a href='/'><div class='logo'><img src='/images/cornerhat.png' class='snoww'><span style='font-family: drunkC; font-size:22px;'>".$forum_r['name']."</span></div> </a>";
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
if($user['status'] >= 2) echo '<div class="err">
<a href="?m=npr&id='.$id.'"><b>Новый подраздел</b></a></div>';
$forum_pr = mysql_query('select * from `forum_pr` where `r` = "'.$id.'"');
while($forum_pr2 = mysql_fetch_array($forum_pr)){
echo '<div class="post1"><img src="/images/tops.png"/> <a href="/forum/pr'.$forum_pr2['id'].'" ><b>'.$forum_pr2['name'].'</b></a> ('.mysql_result(mysql_query('select count(`id`) from `forum_t` where `r` = "'.$forum_pr2['r'].'" and `pr` = "'.$forum_pr2['id'].'"'),0).'/'.mysql_result(mysql_query('select count(`id`) from `forum_m` where `r` = "'.$forum_pr2['r'].'" and `pr` = "'.$forum_pr2['id'].'"'),0).')';
if($user['status'] >= 2) echo ' [<a href="/forum?m=epr&id='.$forum_pr2['id'].'" >ред</a>] [<a href="?m=dpr&pr='.$forum_pr2['id'].'" >уд</a>]';
echo '</div>';
$forum_pr2_last = mysql_query('select * from `forum_t` where `pr` = "'.$forum_pr2['id'].'" order by `ltime` desc limit 1');
while($forum_pr2_last2 = mysql_fetch_array($forum_pr2_last)){
$last2_m = mysql_result(mysql_query('select count(`id`) from `forum_m` where `t` = "'.$forum_pr2_last2['id'].'"'),0);
echo '<div class="post2">';
if($forum_pr2_last2['check'] == 0){
if($forum_pr2_last2['status'] == 0) echo '<img src="/modules/forum/images/the.png"/> '; else echo '<img src="/modules/forum/images/closed.png"/> ';
}else{
echo '<img src="/modules/forum/images/check.png"/> ';
}
echo '<a href="/forum/t'.$forum_pr2_last2['id'].'">'.$forum_pr2_last2['name'].'</a> ('.$last2_m.') <a href="/forum/t'.$forum_pr2_last2['id'].'/p'.ceil(($forum_pr2_last2_m+1)/10).'">></a><br>
<small>'.ustatus($forum_pr2_last2['author']).' <a href="/us'.$forum_pr2_last2['author'].'">'.uname($forum_pr2_last2['author']).'</a> '.uaccess($forum_pr2_last2['author']).' / '.ustatus($forum_pr2_last2['last']).' <a href="/us'.$forum_pr2_last2['last'].'">'.uname($forum_pr2_last2['last']).'</a> '.uaccess($forum_pr2_last2['last']).' ('.times($forum_pr2_last2['ltime']).')</small></div>';
}
}
break;
/////////////раздел .//////
/////////////подраздел .//////
case 'pr':
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id)){
header('Location: /forum'); exit;
}
$forum_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$id.'"'));
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$forum_pr['r'].'"'));
if($forum_pr == 0){
header('Location: /forum'); exit;
}
echo "<a href='/forum'><div class='logo'><img src='/images/cornerhat.png' class='snoww'><span style='font-family: drunkC; font-size:22px;'>Форум</span></div> </a>";
echo ' <div class="tegi"><a href="/forum/r'.$forum_pr['r'].'" >'.$forum_r['name'].'</a> | '.$forum_pr['name'].'</b>
</div></div></div><div class="start">';
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
if($user['id']){
echo '<div class="msg"><img src="/modules/forum/images/nt.png"/> <a href="/forum/nt'.$id.'" > Новая тема</a></div>';
}
$cop = $user['on_page'];
$ca = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_t` WHERE `pr`='".$id."'"),0);
$cp = ceil($ca/$cop);
if(isset($_GET['p']) && is_numeric($_GET['p'])){
$p = $_GET['p'];
if($_GET['p']>$cp) $p = $cp;
if($_GET['p']<1)$p = 1;
}else{
$p = 1;
}
$start = $p*$cop-$cop;
$forum_t = mysql_query("SELECT * FROM `forum_t` WHERE `pr`='".$id."' ORDER BY `check` desc,`time` desc LIMIT $start,$cop");
while($forum_t2 = mysql_fetch_assoc($forum_t)){
echo '<div class="post2">';
if($forum_t2['check'] == 0){
if($forum_t2['status'] == 0) echo '<img src="/modules/forum/images/the.png"/> '; elseif($forum_t2['status'] == 1) echo '<img src="/modules/forum/images/closed.png"/> ';
}else{
echo '<img src="/modules/forum/images/check.png"/> ';
}
$t_m = mysql_result(mysql_query('select count(`id`) from `forum_m` where `t` = "'.$forum_t2['id'].'"'),0);
echo '<a href="/forum/t'.$forum_t2['id'].'">'.$forum_t2['name'].'</a> ('.$t_m.') <a href="/forum/t'.$forum_t2['id'].'/p'.ceil(($t_m+1)/10).'">></a><br>
';
$forum_t2_files = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_m` WHERE `file` != '' and `t` = '".$forum_t2['id']."'"),0);
if($forum_t2_files != 0) echo '<img src="/modules/forum/images/page_white_get.png"/> Файлов: <a href="/forum/t'.$forum_t2['id'].'/files">'.$forum_t2_files.'</a><br>';
echo '<small>'.ustatus($forum_t2['author']).' <a href="/us'.$forum_t2['author'].'">'.uname($forum_t2['author']).'</a> '.uaccess($forum_t2['author']).'/'.ustatus($forum_t2['last']).' <a href="/us'.$forum_t2['last'].'">'.uname($forum_t2['last']).'</a> '.uaccess($forum_t2['last']).' ('.times($forum_t2['ltime']).')</small></div>';
}
echo '<div class="spis">Стр. ';
if($p-2>0) echo '<a href="/forum/pr'.$id.'/p1"><<</a> ';
if($p-1>0) echo '<a href="/forum/pr'.$id.'/p'.($p-1).'"><</a> ';
if($p-3>0) echo '<a href="/forum/pr'.$id.'/p'.($p-3).'">'.($p-3).'</a> | ';
if($p-2>0) echo '<a href="/forum/pr'.$id.'/p'.($p-2).'">'.($p-2).'</a> | ';
if($p-1>0) echo '<a href="/forum/pr'.$id.'/p'.($p-1).'">'.($p-1).'</a> | ';
echo '<b>'.$p.'</b>';
if($p+1<=$cp) echo ' | <a href="/forum/pr'.$id.'/p'.($p+1).'">'.($p+1).'</a>';
if($p+2<=$cp) echo ' | <a href="/forum/pr'.$id.'/p'.($p+2).'">'.($p+2).'</a>';
if($p+3<=$cp) echo ' | <a href="/forum/pr'.$id.'/p'.($p+3).'">'.($p+3).'</a>';
if($p+1<=$cp) echo ' <a href="/forum/pr'.$id.'/p'.($p+1).'">></a>';
if($p+2<=$cp) echo ' <a href="/forum/pr'.$id.'/p'.ceil($ca/$cop).'">>></a>';
echo '</div><div class="tegi"><center><img src="/modules/forum/images/alll.png"/> <a href="/forum/rul'.$id.'" >Правила подраздела</a> | <img src="/modules/forum/images/emoc.png"/> <a href="/smiles.php" >Смайлы</a> | <img src="/modules/forum/images/cod.png"/> <a href="/bbcode.php" >ББ коды</a> | <img src="/modules/forum/images/usear.png"/> <a href="/forum/search" >Поиск</a></center></div>';
break;
/////////////подраздел .//////
/////////////скачать тему .//////
case 'txt':
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id))
{
header('Location: /forum'); exit;
}
$forum_t = mysql_fetch_array(mysql_query('select * from `forum_t` where `id` = "'.$id.'"'));
$forum_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$forum_t['pr'].'"'));
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$forum_pr['r'].'"'));
if($forum_r == 0 or $forum_pr == 0 or $forum_t == 0)
{
header('Location: /forum'); exit;
}
ob_clean();
ob_implicit_flush();
header('Content-Type: text/plain; charset=utf-8', true);
header('Content-Disposition: attachment; filename="'.$forum_r['id'].'_'.$forum_pr['id'].'_'.$forum_t['id'].'.txt";');
echo "
Wap-Code.RUrn
- - -rn
$forum_r[name] | $forum_pr[name] | $forum_t[name]rn
- - -rn";
$post_i = 1;
$forum_m = mysql_query("SELECT * FROM `forum_m` WHERE `t`='".$id."' ORDER BY `id`");
while($forum_m2 = mysql_fetch_array($forum_m))
{
$author = mysql_fetch_array(mysql_query('select * from `user` where `id` = "'.$forum_m2['author'].'"'));
echo "
".$post_i++.". ".$author[login]." (".times($forum_m2[time]).")rn";
if(!empty($forum_m2['cit'])){
$cit = mysql_fetch_array(mysql_query('select * from `forum_m` where `id` = "'.$forum_m2['cit'].'"'));
$cit_author = mysql_fetch_array(mysql_query('select * from `user` where `id` = "'.$cit['author'].'"'));
echo "
Цитата ".$cit_author[login].":rn".$cit[text]."rn";
}
echo "
".$forum_m2['text']."rnrn";
}
echo "
http://Wap-Code.ru/forum/t$idrn";
exit;
break;
/////////////скачать тему .//////
/////////////тема .//////
case 't':
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id))
{
header('Location: /forum'); exit;
}
$forum_t = mysql_fetch_array(mysql_query('select * from `forum_t` where `id` = "'.$id.'"'));
$forum_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$forum_t['pr'].'"'));
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$forum_pr['r'].'"'));
if($forum_r == 0 or $forum_pr == 0 or $forum_t == 0)
{
header('Location: /forum'); exit;
}
/////////////визиты в тему .//////
$forum_visit = mysql_fetch_array(mysql_query('select `who`,`t` from `forum_visit` where `t` = "'.$id.'" and `who` = "'.$user['id'].'" limit 1'));
if($forum_visit == 0)
{
mysql_query("INSERT INTO `forum_visit`(
`r`,
`pr`,
`t`,
`who`,
`time`
)VALUES(
'".$forum_r['id']."',
'".$forum_pr['id']."',
'".$id."',
'".$user['id']."',
'".time()."'
)");
}
else
{
mysql_query("UPDATE `forum_visit` SET `time`='".time()."' WHERE `who`='".$user['id']."' and `t` = '".$id."' limit 1");
}
/////////////визиты в тему .//////
/////////////подписаться .//////
if(isset($_GET['rss']))
{
$forum_rss = mysql_fetch_array(mysql_query('select * from `forum_rss` where `t` = "'.$id.'" and `who` = "'.$user['id'].'" limit 1'));
if($forum_rss == 0){
mysql_query("INSERT INTO `forum_rss`(
`t`,
`who`
)VALUES(
'".$id."',
'".$user['id']."'
)");
}
else
{
mysql_query("DELETE FROM `forum_rss` WHERE `t` = '".$id."' and `who` = '".$user['id']."'");
}
header('Location: /forum/t'.$id.'/p'.$p.'');
}
/////////////подписаться .//////
/////////////закрыто,открыто .//////
if(isset($_GET['check']) && $user['status'] >= 1)
{
if($forum_t['check'] == 0)
{
mysql_query("UPDATE `forum_t` SET `check`='1' WHERE `id` = '".$id."' limit 1");
}
else
{
mysql_query("UPDATE `forum_t` SET `check`='0' WHERE `id` = '".$id."' limit 1");
}
header('Location: /forum/t'.$id.'/p'.$p.'');
}
/////////////закрыто,открыто .//////
$forum_rss = mysql_fetch_array(mysql_query('select * from `forum_rss` where `t` = "'.$id.'" and `who` = "'.$user['id'].'" limit 1'));
echo ' <div class="tegi"><a href="/forum" ><b>Форум</a> | <a href="/forum/r'.$forum_pr['r'].'" >'.$forum_r['name'].'</a> | <a href="/forum/pr'.$forum_pr['id'].'" >'.$forum_pr['name'].'</a> | '.$forum_t['name'].'</b></div></div>';
echo '</div>';
echo '<div class="start">';
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
if($forum_t['status'] == 1) echo '<div class="err"><img src="/modules/forum/images/closed.png"/> <b> Тема закрыта!</b></div>';
$cop = $user['on_page'];
$ca = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_m` WHERE `t`='".$id."'"),0);
$cp = ceil($ca/$cop);
if(isset($_GET['p']) && is_numeric($_GET['p'])){
$p = $_GET['p'];
if($_GET['p']>$cp) $p = $cp;
if($_GET['p']<1)$p = 1;
}else{
$p = 1;
}
$start = $p*$cop-$cop;
if($p == 1) $post_i = $p;
elseif($p == 2) $post_i = ($p+9);
else $post_i = ($p*10)-9;
echo '<div class="post2"><small><a href="/forum/t'.$id.'/p'.$p.'">Обновить</a>';
if($user['status'] >= 1)
{
if($forum_t['status'] == 0) echo ' | <a href="/forum/t'.$id.'/status">Закрыть</a>';
else
echo ' | <a href="/forum/t'.$id.'/status">Открыть</a>';
}
$forum_rss = mysql_fetch_array(mysql_query('select * from `forum_rss` where `t` = "'.$id.'" and `who` = "'.$user['id'].'" limit 1'));
echo ($forum_rss == 0 ? ' | <a href="/forum/t'.$id.'/p'.$p.'?rss">Подписаться</a>' : ' | <a href="/forum/t'.$id.'/p'.$p.'/?rss">Отписаться</a>');
if($user['status'] > 1) echo ' | <a href="/forum/ted'.$id.'">Изменить</a> | <a href="/forum/tdel'.$id.'">Удалить</a>';
if($user['status'] >= 1)
{
if($forum_t['check'] == 0) echo ' | <a href="/forum/t'.$id.'/p'.$p.'?check">Закрепить</a>'; else echo ' | <a href="/forum/t'.$id.'/p'.$p.'?check">Открепить</a>';
}
if($forum_t['author'] == $user['id'] or $user['status'] >= 1)
{
$forum_vote = mysql_fetch_array(mysql_query('select * from `forum_vote` where `t` = "'.$id.'" limit 1'));
echo ($forum_vote == 0 ? ' | <a href="/forum/t'.$id.'/vote">Добавить опрос</a>' : ' | <a href="/forum/t'.$id.'/vote">Удалить опрос</a>');
}
echo '<br>';
/////////////сказать спасибо .//////
$thnx = mysql_fetch_array(mysql_query('select * from `forum_t_thnx` where `t` = "'.$id.'" and `user` = "'.$user['id'].'" limit 1'));
if($thnx == 0 && $forum_t['author'] != $user['id'])
{
if(isset($_GET['thnx']))
{
mysql_query("INSERT INTO `forum_t_thnx`(
`t`,
`user`,
`ho`,
`time`
)VALUES(
'".$id."',
'".$user['id']."',
'".$forum_t['author']."',
'".time()."'
)");
header('Location: /forum/t'.$id.'/p'.$p.''); exit;
}
echo 'Полезная тема?<br><a href="/forum/t'.$id.'/p'.$p.'?thnx">Сказать спасибо</a> автору';
}
else
{
echo 'Сказали спасибо: <a href="/forum/t'.$id.'/sps">'.mysql_result(mysql_query('select count(`id`) from `forum_t_thnx` where `t` = "'.$id.'"'),0).'</a> чел.';
}
/////////////сказать спасибо .//////
/////////////голосование .//////
echo '</small></div>';
if($forum_t['status'] == 0){
$forum_vote = mysql_fetch_array(mysql_query('select * from `forum_vote` where `t` = "'.$id.'" limit 1'));
if($forum_vote != 0)
{
if(isset($_POST['add_vote']))
{
$vote = TextGuard($_POST['vote']);
if(empty($vote) or !is_numeric($vote) or $vote <= 0 or $vote >= 6)
{
header('Location: /forum/t'.$id.'/p'.$p.''); exit;
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_votes` WHERE `vote`='".$forum_vote['id']."' and `who` = '".$user['id']."'"),0) == 0)
{
mysql_query("INSERT INTO `forum_votes`(
`who`,
`vote`,
`select`
)VALUES(
'".$user['id']."',
'".$forum_vote['id']."',
'".$vote."'
)");
}
else
{
header('Location: /forum/t'.$id.'/p'.$p.''); exit;
}
header('Location: /forum/t'.$id.'/p'.$p.''); exit;
}
echo '<div class="tegi"><b>Опрос: </b>'.$forum_vote['quest'];
if($user['status'] >= 1 or $forum_t['author'] == $user['id']) echo ' [<a href="/forum/t'.$id.'/vote_edit" >ред</a>]';
echo '</div><div class="post2">';
if(empty($forum_vote['select_1'])) $fvs1 = 0; else $fvs1 = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_votes` WHERE `vote`='".$forum_vote['id']."' and `select` = '1'"),0);
if(empty($forum_vote['select_2'])) $fvs2 = 0; else $fvs2 = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_votes` WHERE `vote`='".$forum_vote['id']."' and `select` = '2'"),0);
if(empty($forum_vote['select_3'])) $fvs3 = 0; else $fvs3 = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_votes` WHERE `vote`='".$forum_vote['id']."' and `select` = '3'"),0);
if(empty($forum_vote['select_4'])) $fvs4 = 0; else $fvs4 = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_votes` WHERE `vote`='".$forum_vote['id']."' and `select` = '4'"),0);
if(empty($forum_vote['select_5'])) $fvs5 = 0; else $fvs5 = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_votes` WHERE `vote`='".$forum_vote['id']."' and `select` = '5'"),0);
$vote_all = round($fvs1+$fvs2+$fvs3+$fvs4+$fvs5);
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_votes` WHERE `vote`='".$forum_vote['id']."' and `who` = '".$user['id']."'"),0) == 0)
{
echo '<form action="/forum/t'.$id.'/p'.$p.'" method="post"><table cellpadding="0" cellspacing="0">';
if(!empty($forum_vote['select_1'])) echo '<tr><td><input type="radio" value="1" name="vote"/></td><td style="padding-left:10px;">
'.$forum_vote['select_1'].'<br>
<img src="/modules/forum/img.php?p='.round(100/($vote_all/$fvs1)).'&k='.$fvs1.'&a='.$vote_all.'" alt="*"/>
</td></tr>';
if(!empty($forum_vote['select_2'])) echo '<tr><td><input type="radio" value="2" name="vote"/></td><td style="padding-left:10px;">
'.$forum_vote['select_2'].'<br>
<img src="/modules/forum/img.php?p='.round(100/($vote_all/$fvs2)).'&k='.$fvs2.'&a='.$vote_all.'" alt="*"/></td></tr>';
if(!empty($forum_vote['select_3'])) echo '<tr><td><input type="radio" value="3" name="vote"/></td><td style="padding-left:10px;">'.$forum_vote['select_3'].'<br>
<img src="/modules/forum/img.php?p='.round(100/($vote_all/$fvs3)).'&k='.$fvs3.'&a='.$vote_all.'" alt="*"/></td></tr>';
if(!empty($forum_vote['select_4'])) echo '<tr><td><input type="radio" value="4" name="vote"/></td><td style="padding-left:10px;">'.$forum_vote['select_4'].'<br>
<img src="/modules/forum/img.php?p='.round(100/($vote_all/$fvs4)).'&k='.$fvs4.'&a='.$vote_all.'" alt="*"/></td></tr>';
if(!empty($forum_vote['select_5'])) echo '<tr><td><input type="radio" value="5" name="vote"/></td><td style="padding-left:10px;">'.$forum_vote['select_5'].'<br>
<img src="/modules/forum/img.php?p='.round(100/($vote_all/$fvs5)).'&k='.$fvs5.'&a='.$vote_all.'" alt="*"/></td></tr>';
echo '</table><br><input type="submit" name="add_vote" value="Проголосовать"/></form>';
}else{
echo '<table cellpadding="0" cellspacing="0">';
if(!empty($forum_vote['select_1']))
{
echo '<tr><td>'.$forum_vote['select_1'].'</td><td style="padding-left:10px;">
<img src="/modules/forum/img.php?p='.round(100/($vote_all/$fvs1)).'&k='.$fvs1.'&a='.$vote_all.'" alt="*"/></td></tr>';
}
if(!empty($forum_vote['select_2']))
{
echo '<tr><td>'.$forum_vote['select_2'].'</td><td style="padding-left:10px;">
<img src="/modules/forum/img.php?p='.round(100/($vote_all/$fvs2)).'&k='.$fvs2.'&a='.$vote_all.'" alt="*"/></small></td></tr>';
}
if(!empty($forum_vote['select_3']))
{
echo '<tr><td>'.$forum_vote['select_3'].'</td><td style="padding-left:10px;">
<img src="/modules/forum/img.php?p='.round(100/($vote_all/$fvs3)).'&k='.$fvs3.'&a='.$vote_all.'" alt="*"/></small></td></tr>';
}
if(!empty($forum_vote['select_4']))
{
echo '<tr><td>'.$forum_vote['select_4'].'</td><td style="padding-left:10px;">
<img src="/modules/forum/img.php?p='.round(100/($vote_all/$fvs4)).'&k='.$fvs4.'&a='.$vote_all.'" alt="*"/></td></tr>';
}
if(!empty($forum_vote['select_5']))
{
echo '<tr><td><b>'.$forum_vote['select_5'].'</b></td><td style="padding-left:10px;">
<img src="/modules/forum/img.php?p='.round(100/($vote_all/$fvs5)).'&k='.$fvs5.'&a='.$vote_all.'" alt="*"/></td></tr>';
}
echo '</div>';
}
echo '</table><small>В голосовании приняли участие: <a href="/forum/t'.$id.'/vote_members">'.mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_votes` WHERE `vote`='".$forum_vote['id']."'"),0).'</a> чел.</small><br>';
echo '</div>';
}
}
/////////////голосование .//////
////////////// удаление сообщения /////////
if(isset($_GET['dp']))
{
$pid = TextGuard($_GET['pid']);
if(empty($pid) or !is_numeric($pid)){
header('Location: ?'); exit;
}
$forum_m = mysql_fetch_array(mysql_query('select * from `forum_m` where `id` = "'.$pid.'"'));
if($forum_m == 0)
{
header('Location: ?'); exit;
}
if(!$user['id'] && $user['status'] < 1)
{
header('Location: /forum/t'.$forum_m['t'].'/p'.$p.'');
exit;
}
mysql_query("UPDATE `forum_m` SET `text`='[b]Сообщение удалено![/b]',`del2`='1' WHERE `id`='".$pid."' limit 1");
header('Location: /forum/t'.$id.'/p'.$p.'');
}
/////////////удаление сообщения//////////
////////////// голосование за пост //////////
if(isset($_GET['v']))
{
$pid = TextGuard($_GET['pid']);
$go = TextGuard($_GET['go']);
$forum_v = mysql_fetch_array(mysql_query('select * from `forum_v` where `t` = "'.$id.'" and `m` = "'.$pid.'" and `who` = "'.$user['id'].'" limit 1'));
if(empty($pid) or !is_numeric($pid) or empty($go) or $go != "p" && $go != "m" or $forum_v != 0)
{
header('Location: ?'); exit;
}
if($go == "p") $status = 1; elseif($go == "m") $status = 2;
$forum_m = mysql_fetch_array(mysql_query('select * from `forum_m` where `id` = "'.$pid.'"'));
if($forum_m == 0 or $forum_m['author'] == $user['id'])
{
header('Location: ?'); exit;
}
$forum_t = mysql_fetch_array(mysql_query('select * from `forum_t` where `id` = "'.$forum_m['t'].'"'));
if($forum_t == 0)
{
header('Location: ?'); exit;
}
$forum_vss = mysql_fetch_array(mysql_query('select * from `forum_v` where `ho` = '.$forum_m['author'].' and `who` = "'.$user['id'].'" ORDER BY `id` DESC limit 1'));
if((time()-$forum_vss['time']) < ((60*60)*12)){ $err[] = 'Рейтинг можно изменять раз в сутки!';
}else{
mysql_query("INSERT INTO `forum_v`(
`t`,
`m`,
`who`,
`ho`,
`time`,
`status`
)VALUES(
'".$id."',
'".$pid."',
'".$user['id']."',
'".$forum_m['author']."',
'".time()."',
'".$status."'
)");
$forum_m_author = mysql_fetch_array(mysql_query('select * from `user` where `id` = "'.$forum_m['author'].'"'));
if($forum_m_author != 0){
if($status == 1){
mysql_query("UPDATE `user` SET `rating`='".($forum_m_author['rating']+0.01)."' WHERE `id`='".$forum_m_author['id']."' limit 1");
mysql_query("INSERT INTO `op`(
`who`,
`ho`,
`text`,
`time`,
`read`,
`sort`
)VALUES(
'".$forum_m_author['id']."',
'".$user['id']."',
'оценил [b]положительно[/b] ваш пост:[br]".$forum_m['text']." в теме [url=/forum/t".$forum_m['t']."]".$forum_t['name']."[/url]!',
'".time()."',
'0',
'2'
)");
}elseif($status == 2){
mysql_query("UPDATE `user` SET `rating`='".($forum_m_author['rating']-0.01)."' WHERE `id`='".$forum_m_author['id']."' limit 1");
mysql_query("INSERT INTO `op`(
`who`,
`ho`,
`text`,
`time`,
`read`,
`sort`
)VALUES(
'".$forum_m_author['id']."',
'".$user['id']."',
'оценил [b]отрицательно[/b] ваш пост:[br]".$forum_m['text']." в теме [url=/forum/t".$forum_m['t']."]".$forum_t['name']."[/url]!',
'".time()."',
'0','2'
)");
}
}
}
}
//////////// конец голосования за пост /////////////
/////////посты .//////
if($ca > 0)
{
$forum_m = mysql_query("SELECT * FROM `forum_m` WHERE `t`='".$id."' ORDER BY `id` LIMIT $start,$cop");
while($forum_m2 = mysql_fetch_assoc($forum_m))
{
echo '<div class="post1">'.$post_i++.'. '.ustatus($forum_m2['author']).' <a href="/us'.$forum_m2['author'].'">'.uname($forum_m2['author']).'</a> '.uaccess($forum_m2['author']).' ';
if($forum_t['author'] == $forum_m2['author']) echo '<font color="green"><b>[автор]</b></font> ';
echo '<font color="grey">('.times($forum_m2['time']).')</font>';
if($forum_t['status'] != 1){
if($forum_m2['del2'] != 1){
if($forum_m2['author'] == $user['id'] or $user['status'] >= 1) echo ' [<a href="/forum/edit'.$forum_m2['id'].'">ред</a>] ';
if($forum_m2['author'] != $user['id']) echo ' [<a href="/forum/t'.$id.'/otv'.$forum_m2['author'].'">отв</a>] [<a href="/forum/cit'.$forum_m2['id'].'">цит</a>]';
if($user['status'] >= 1) echo ' [<a href="/forum/t'.$id.'/p'.$p.'?dp&pid='.$forum_m2['id'].'">уд</a>]';
}
}
if($forum_t['status'] == 0){
if($forum_m2['author'] != $user['id']){
$forum_vs = mysql_fetch_array(mysql_query('select * from `forum_v` where `t` = "'.$id.'" and `m` = "'.$forum_m2['id'].'" and `who` = "'.$user['id'].'" limit 1'));
$forum_vss = mysql_fetch_array(mysql_query('select * from `forum_v` where `ho` = '.$forum_m2['author'].' and `who` = "'.$user['id'].'" ORDER BY `id` DESC limit 1'));
if((time()-$forum_vss['time']) < ((60*60)*12)){
echo '';
}else{
if($forum_vs == 0) echo ' <a href="/forum/t'.$id.'?v&pid='.$forum_m2['id'].'&go=p&p='.$p.'">+</a> | <a href="/forum/t'.$id.'?v&pid='.$forum_m2['id'].'&go=m&p='.$p.'">-</a>';
}}}
echo ' (<font color="green">'.mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_v` WHERE `t` = '".$id."' and `m` = '".$forum_m2['id']."' and `status` = '1'"),0).'</font>/<font color="red">'.mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_v` WHERE `t` = '".$id."' and `m` = '".$forum_m2['id']."' and `status` = '2'"),0).'</font>)<br>';
/////////посты .//////
/////////// цитаты в сообщении //////////
if(!empty($forum_m2['cit'])){
$cit = mysql_fetch_array(mysql_query('select * from `forum_m` where `id` = "'.$forum_m2['cit'].'"'));
$cit_author = mysql_fetch_array(mysql_query('select * from `user` where `id` = "'.$cit['author'].'"'));
echo 'Цитата <a href="/us'.$cit_author['id'].'">'.uname($cit_author['id']).'</a>:<br><div class="cit">'.smiles(bbcode($cit['text'])).'</div>';
}
/////////////// конец цитаты в теме /////////////
echo ''.smiles(bbcode($forum_m2['text'])).'<br>';
if(!empty($forum_m2['file'])) echo '<br><b>Прикрепленный файл: <a href="/modules/forum/files/'.$forum_m2['file'].'">'.$forum_m2['file'].'</a> ('.round(filesize('files/'.$forum_m2['file'].'')/1024).' кб)</b>';
//////////посл ред//////////////
if($forum_m2['del2'] != 1){
$poste = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_post_edit` where `post` = '".$forum_m2['id']."'"), 0);
if($poste!=0)
{
$postee = mysql_query('select * from `forum_post_edit` where `post` = "'.$forum_m2['id'].'" order by `time` desc limit 1');
while($poste2 = mysql_fetch_array($postee))
{
echo '</br>Редактировано '.$poste.' раз. Посл. ред. '.ustatus($poste2['user']).' <a href="/us'.$poste2['user'].'">'.uname($poste2['user']).'</a> '.uaccess($poste2['user']).'<small><i> '.times($poste2['time']).'</i></small>';
}}}
echo '</div>';
}
}
//////////////посл ред/////////////
if($forum_t['status'] != 1){
if(isset($_POST['text'])){
$text = TextGuard($_POST['text']);
if(empty($text)) $err[] = 'Сообщение осталось пустым...';
$myfm = mysql_query("SELECT * FROM `forum_m` WHERE `author`='".$user['id']."' ORDER BY `time` desc");
while($myfm2 = mysql_fetch_assoc($myfm)){
$myfm_timeout = $myfm2['time'];
if((time()-$myfm_timeout) < 5) $err[] = 'Писать можно только раз в 5 секунд...';
}
$forum_rep = mysql_fetch_array(mysql_query('select * from `forum_m` where `author` = "'.$user['id'].'" and `t` = "'.$id.'" and `text` = "'.$text.'"'));
if($forum_rep != 0) $err[] = 'Вы уже писали такое сообщение...';
/////////загрузка файла .//////
if($user['file'] == 1){
if(@file_exists($_FILES['filename']['tmp_name'])){
if($_FILES['filename']['size'] != 0 and $_FILES['filename']['size'] > 1024000) $err[] = 'Слишком большой файл...';
$filetype = array ( 'jpg', 'gif', 'png', 'jpeg', 'bmp', 'zip', 'rar', '7z', 'txt', 'mp3', 'avi', 'mp4', '3gp' );
$upfiletype = substr($_FILES['filename']['name'], strrpos( $_FILES['filename']['name'], "." )+1);
if(!in_array($upfiletype,$filetype)) $err[] = 'Вы пытаетесь загрузить недопустимый формат файла...';
}}
/////////загрузка файла .//////
if(!$err){
if($user['file'] == 1){
if(@file_exists($_FILES['filename']['tmp_name'])) $fn = date('dmY').'_fn'.rand(1234,5678).'_'.$_FILES['filename']['name']; else $fn = NULL;
if(@file_exists($_FILES['filename']['tmp_name'])){
move_uploaded_file($_FILES['filename']['tmp_name'], "files/".$fn."");
}}
mysql_query("INSERT INTO `forum_m`(
`r`,
`pr`,
`t`,
`author`,
`text`,
`time`,
`file`
)VALUES(
'".$forum_r['id']."',
'".$forum_pr['id']."',
'".$id."',
'".$user['id']."',
'".$text."',
'".time()."',
'".$fn."'
)");
mysql_query("UPDATE `forum_t` SET `last`='".$user['id']."',`ltime`='".time()."' WHERE `id`='".$id."' limit 1");
$forum_rss = mysql_query("SELECT * FROM `forum_rss` WHERE `t`='".$id."'");
while($forum_rss2 = mysql_fetch_assoc($forum_rss)){
if($forum_rss2['who'] != $user['id']){
mysql_query("INSERT INTO `op`(
`who`,
`ho`,
`text`,
`time`,
`read`,
'sort'
)VALUES(
'".$forum_rss2['who']."',
'".$user['id']."',
'ответил в теме [url=/forum/t".$id."/p".$p."]".$forum_t['name']."[/url]!',
'".time()."',
'0',
'3'
)");
}
}
header('Location: /forum/t'.$id.'/p'.$p.''); exit;
}else{
echo '<div class="err">';
foreach($err as $err_info){
echo $err_info.'<br>';
}
echo '</div>';
}
}
echo '<div class="glav"><form action="/forum/t'.$id.'/p'.$p.'?otv" method="post" enctype="multipart/form-data">
Сообщение:<br>
<textarea name="text" rows="3" style="width:98%;"></textarea><br>';
if($user['file'] == 1) echo 'Файл:<br><input type="file" name="filename"/><br>';
echo '<input type="submit" value="Написать"/>
</form></div>';
if(isset($_GET['file'])){
if($user['file'] == 0) $file = 1; else $file = 0;
mysql_query("UPDATE `user` SET `file`='".$file."' WHERE `id`='".$user['id']."' limit 1");
header('Location: /forum/t'.$id.'/p'.$p.''); exit;
}
echo '<div class="err">Прикрепление файлов: <a href="/forum/t'.$id.'/p'.$p.'?file">';
if($user['file'] == 0) echo 'вкл'; elseif($user['file'] == 1) echo 'выкл';
echo '</a></div>';
}
echo '<div class="spis">Стр. ';
if($p-2>0) echo '<a href="/forum/t'.$id.'/p1"><<</a> ';
if($p-1>0) echo '<a href="/forum/t'.$id.'/p'.($p-1).'"><</a> ';
if($p-3>0) echo '<a href="/forum/t'.$id.'/p'.($p-3).'">'.($p-3).'</a> | ';
if($p-2>0) echo '<a href="/forum/t'.$id.'/p'.($p-2).'">'.($p-2).'</a> | ';
if($p-1>0) echo '<a href="/forum/t'.$id.'/p'.($p-1).'">'.($p-1).'</a> | ';
echo '<b>'.$p.'</b>';
if($p+1<=$cp) echo ' | <a href="/forum/t'.$id.'/p'.($p+1).'">'.($p+1).'</a>';
if($p+2<=$cp) echo ' | <a href="/forum/t'.$id.'/p'.($p+2).'">'.($p+2).'</a>';
if($p+3<=$cp) echo ' | <a href="/forum/t'.$id.'/p'.($p+3).'">'.($p+3).'</a>';
if($p+1<=$cp) echo ' <a href="/forum/t'.$id.'/p'.($p+1).'">></a>';
if($p+2<=$cp) echo ' <a href="/forum/t'.$id.'/p'.ceil($ca/$cop).'">>></a>';
$link = 't'.$id.'';
echo '</div><div class="post2">';
echo 'В теме: <a href="/forum/t'.$id.'/who">'.mysql_result(mysql_query('select count(`id`) from `user` where `self` LIKE "%'.$link.'%" and `online` > "'.(time()-360).'"'),0).' человек</a>, <a href="/forum/t'.$id.'/vis">'.mysql_result(mysql_query('select count(`id`) from `forum_visit` where `t` = "'.$id.'"'),0).'</a> заходили<br>
<img src="/modules/forum/images/download.png"/> <a href="/forum/?m=txt&id='.$id.'">Скачать тему</a> | <img src="/modules/forum/images/files.png"/> <a href="/forum/t'.$id.'/files">Файлы топика</a></div>
<div class="tegi"><img src="/modules/forum/images/alll.png"/> <a href="/forum/rul'.$forum_pr['id'].'" >Правила</a> | <img src="/modules/forum/images/emoc.png"/> <a href="/smiles.php" >Смайлы</a> | <img src="/modules/forum/images/cod.png"/> <a href="/bbcode.php" >ББ коды</a> | <img src="/modules/forum/images/usear.png"/> <a href="/forum/search" >Поиск</a></div>';
echo '</div></div>';
break;
/////////тема .//////
/////////изминение темы .//////
case 'ted':
if($user['status'] < 1){
header('Location: /forum'); exit;
}
$id = TextGuard($_GET['id']);
$forum_t = mysql_fetch_array(mysql_query('select * from `forum_t` where `id` = "'.$id.'" limit 1'));
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$forum_t['r'].'" limit 1'));
$forum_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$forum_t['pr'].'" limit 1'));
if(empty($id) or !is_numeric($id) or $forum_t == 0 or $forum_r == 0 or $forum_pr == 0){
header('Location: /forum'); exit;
}
echo ' <div class="tegi"><a href="/forum" ><b>Форум</a> | <a href="/forum/r'.$forum_pr['r'].'" >'.$forum_r['name'].'</a> | <a href="/forum/pr'.$forum_pr['id'].'" >'.$forum_pr['name'].'</a> | '.$forum_t['name'].'</b></div></div>';
echo '</div>';
echo '<div class="start">';
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
if(isset($_POST['submit'])){
$text = TextGuard($_POST['text']);
if(empty($text)) $err[] = 'Название осталось пустым...';
$r = TextGuard($_POST['r']);
$pr = TextGuard($_POST['pr']);
if(!$err){
if($r != $forum_r['id'] || $pr != $forum_pr['id']){
$forum_r2 = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$r.'" limit 1'));
$forum_pr2 = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$pr.'" limit 1'));
mysql_query("INSERT INTO `forum_m`(
`r`,
`pr`,
`t`,
`author`,
`text`,
`time`,
`file`
)VALUES(
'".$forum_r['id']."',
'".$forum_pr['id']."',
'".$id."',
'".$user['id']."',
'Тема перенесена в [b]".$forum_r2['name']."[/b]/[b]".$forum_pr2['name']."[/b]!',
'".time()."',
'".$fn."'
)");
}
mysql_query("UPDATE `forum_t` SET `name`='".$text."',`r`='".$r."',`pr`='".$pr."' WHERE `id` = '".$id."' limit 1");
header('Location: /forum/t'.$id.''); exit;
}else{
echo '<div class="err">';
foreach($err as $err_info){
echo $err_info.'<br>';
}
echo '</div>';
}
}
echo '<div class="mist">
<form action="" method="post">
Название:<br><input name="text" value="'.$forum_t['name'].'"/><br>
Перенести в:<br><select name="r">';
$t_forum_r = mysql_query('select * from `forum_r`');
while($t_forum_r2 = mysql_fetch_array($t_forum_r)){
echo '<option value="'.$t_forum_r2['id'].'">'.$t_forum_r2['name'].'</option>';
}
echo '</select> - <select name="pr">';
$t_forum_pr = mysql_query('select * from `forum_pr`');
while($t_forum_pr2 = mysql_fetch_array($t_forum_pr)){
echo '<option value="'.$t_forum_pr2['id'].'">'.$t_forum_pr2['name'].'</option>';
}
echo '</select><br><input type="submit" value="Сохранить" name="submit"/>
</form></div>';
break;
/////////изминение темы .//////
/////////удаление темы .//////
case 'tdel':
if($user['status'] < 1){
header('Location: /forum'); exit;
}
$id = TextGuard($_GET['id']);
$forum_t = mysql_fetch_array(mysql_query('select * from `forum_t` where `id` = "'.$id.'" limit 1'));
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$forum_t['r'].'" limit 1'));
$forum_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$forum_t['pr'].'" limit 1'));
if(empty($id) or !is_numeric($id) or $forum_t == 0 or $forum_r == 0 or $forum_pr == 0){
header('Location: /forum'); exit;
}
$forum_m = mysql_query('select * from `forum_m` where `t` = "'.$id.'"');
while($forum_m2 = mysql_fetch_array($forum_m)){
mysql_query("DELETE FROM `forum_m` WHERE `id` = '".$forum_m2['id']."'");
}
mysql_query("DELETE FROM `forum_t` WHERE `id` = '$id'");
header('Location: /forum'); exit;
break;
case 'status':
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id)){
header('Location: ?'); exit;
}
$forum_t = mysql_fetch_array(mysql_query('select * from `forum_t` where `id` = "'.$id.'"'));
$forum_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$forum_t['pr'].'"'));
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$forum_pr['r'].'"'));
if($user['status'] < 1){
header('Location: /forum/t'.$id.'/p'.ceil(($forum_m+1)/10).''); exit;
}
if($forum_t == 0 or $forum_pr == 0 or $forum_r == 0){
header('Location: ?'); exit;
}
if($forum_t['status'] == 0){
$status = 1;
$status_text = 'Тема закрыта для обсуждения! :-)';
}else{
$status = 0;
$status_text = 'Тема открыта для обсуждения! :-)';
}
mysql_query("UPDATE `forum_t` SET `status`='".$status."' WHERE `id`='".$id."' limit 1");
mysql_query("INSERT INTO `forum_m`(
`r`,
`pr`,
`t`,
`author`,
`text`,
`time`
)VALUES(
'".$forum_r['id']."',
'".$forum_pr['id']."',
'".$id."',
'".$user['id']."',
'[b]".$status_text."[/b]',
'".time()."'
)");
mysql_query("UPDATE `forum_t` SET `last`='".$user['id']."',`ltime`='".time()."' WHERE `id`='".$id."' limit 1");
$forum_m = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_m` WHERE `t`='".$id."'"),0);
header('Location: /forum/t'.$id.'/p'.ceil(($forum_m+1)/10).''); exit;
break;
/////////удаление темы .//////
/////////кто в теме .//////
case 'who':
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id)){
header('Location: ?'); exit;
}
$forum_t = mysql_fetch_array(mysql_query('select * from `forum_t` where `id` = "'.$id.'"'));
if($forum_t == 0){
header('Location: ?'); exit;
}
$link = '/forum/t'.$id.'';
echo ' <div class="tegi"><b>В теме "'.$forum_t['name'].'</b></div></div>';
echo '</div>';
echo '<div class="start">';
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
echo '<div class="post1">';
$forum_who = mysql_query("SELECT * FROM `user` WHERE `self` LIKE '%".$link."%' and `online` > '".(time()-360)."'");
while($forum_who2 = mysql_fetch_array($forum_who)){
echo ''.ustatus($forum_who2['id']).' <a href="/us'.$forum_who2['id'].'">'.uname($forum_who2['id']).'</a> '.uaccess($forum_who2['id']).', ';
}
echo '</div><div class="spis"><a href="/forum/t'.$id.'">Назад</a></div>';
break;
/////////кто в теме .//////
/////////кто был в теме .//////
case 'visits':
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id)){
header('Location: ?'); exit;
}
$forum_t = mysql_fetch_array(mysql_query('select * from `forum_t` where `id` = "'.$id.'"'));
if($forum_t == 0){
header('Location: ?'); exit;
}
$in = mysql_result(mysql_query('select count(`id`) from `forum_visit` where `t` = "'.$id.'"'),0);
echo ' <div class="tegi"><b>В тему "'.$forum_t['name'].'</b>" зашло '.$in.' человек</b></div></div>';
echo '</div>';
echo '<div class="start">';
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
$cop = $user['on_page'];
$ca = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_visit` WHERE `t`='".$id."'"),0);
$cp = ceil($ca/$cop);
if(isset($_GET['p']) && is_numeric($_GET['p'])){
$p = $_GET['p'];
if($_GET['p']>$cp) $p = $cp;
if($_GET['p']<1)$p = 1;
}else{
$p = 1;
}
$start = $p*$cop-$cop;
if($ca > 0){
$forum_visit = mysql_query("SELECT * FROM `forum_visit` WHERE `t`='".$id."' ORDER BY `time` desc LIMIT $start,$cop");
while($forum_visit2 = mysql_fetch_assoc($forum_visit)){
echo '<div class="post1">'.ustatus($forum_visit2['who']).' <a href="/us'.$forum_visit2['who'].'">'.uname($forum_visit2['who']).'</a> '.uaccess($forum_visit2['who']).' ('.times($forum_visit2['time']).')</div>';
}}else{
echo '';
}
echo '<div class="spis">Стр. ';
if($p-2>0) echo '<a href="/forum/t'.$id.'/vis/p1"><<</a> ';
if($p-1>0) echo '<a href="/forum/t'.$id.'/vis/p'.($p-1).'"><</a> ';
if($p-3>0) echo '<a href="/forum/t'.$id.'/vis/p'.($p-3).'">'.($p-3).'</a> | ';
if($p-2>0) echo '<a href="/forum/t'.$id.'/vis/p'.($p-2).'">'.($p-2).'</a> | ';
if($p-1>0) echo '<a href="/forum/t'.$id.'/vis/p'.($p-1).'">'.($p-1).'</a> | ';
echo '<b>'.$p.'</b>';
if($p+1<=$cp) echo ' | <a href="/forum/t'.$id.'/vis/p'.($p+1).'">'.($p+1).'</a>';
if($p+2<=$cp) echo ' | <a href="/forum/t'.$id.'/vis/p'.($p+2).'">'.($p+2).'</a>';
if($p+3<=$cp) echo ' | <a href="/forum/t'.$id.'/vis/p'.($p+3).'">'.($p+3).'</a>';
if($p+1<=$cp) echo ' <a href="/forum/t'.$id.'/vis/p'.($p+1).'">></a>';
if($p+2<=$cp) echo ' <a href="/forum/t'.$id.'/vis/p'.ceil($ca/$cop).'">>></a>';
echo '</div><div class="levo"><a href="/forum/t'.$id.'">Назад</a></div>';
break;
/////////кто был в теме .//////
/////////правила .//////
case 'rules':
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id)){
header('Location: ?'); exit;
}
$forum_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$id.'"'));
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$forum_pr['r'].'"'));
if($forum_pr == 0 or $forum_r == 0){
header('Location: /forum'); exit;
}
echo ' <div class="tegi"><b><a href="?m=r&id='.$forum_pr['r'].'" >'.$forum_r['name'].'</a> | '.$forum_pr['name'].'</b></div></div>';
echo '</div>';
echo '<div class="start">';
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
echo '<div class="post2">
<font color="red"><b>Правила и информация:</b></font><br>';
$forum_pr_rules = mysql_fetch_array(mysql_query('select `text` from `forum_pr_rules` where `pr` = "'.$id.'" limit 1'));
echo smiles(bbcode($forum_pr_rules['text']));
echo '</div>';
break;
/////////правила .//////
/////////ответить .//////
case 'otv':
if(!$user['id']){
header('Location: /forum/t'.$id.''); exit;
}
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id)){
header('Location: ?'); exit;
}
if(empty($otv) or !is_numeric($otv) or $otv == $user['id']){
header('Location: /forum/t'.$id.''); exit;
}
$forum_t = mysql_fetch_array(mysql_query('select * from `forum_t` where `id` = "'.$id.'"'));
$forum_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$forum_t['pr'].'"'));
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$forum_pr['r'].'"'));
if($forum_t == 0){
header('Location: ?'); exit;
}
if($forum_t['status'] == 1){
header('Location: /forum/t'.$id.''); exit;
}
$otv2 = mysql_fetch_array(mysql_query('select * from `user` where `id` = "'.$otv.'"'));
$nicks = mysql_query("SELECT * FROM `nicks` where `who` = '".$otv."' ORDER BY `id` DESC LIMIT 1");
while($nicks2 = mysql_fetch_assoc($nicks)){
$nick = $nicks2['new'];
}
if(empty($nick)) $nick = $otv2['login'];
echo ' <div class="tegi"><b><a href="?m=r&id='.$forum_pr['r'].'" >'.$forum_r['name'].'</a> | <a href="?m=pr&id='.$forum_pr['id'].'" >'.$forum_pr['name'].'</a> | <a href="?m=t&id='.$forum_t['id'].'" >'.$forum_t['name'].'</a></b></div></div>';
echo '</div>';
echo '<div class="start">';
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
if(isset($_POST['text'])){
$text = TextGuard($_POST['text']);
if(mysql_result(mysql_query('select * from `forum_m` where `text` LIKE "%'.$text.'%" and `t` = "'.$id.'" limit 1'),0) != 0) $err[] = 'Вы уже писали это сообщение!';
if(empty($text)) $err[] = 'Сообщение осталось пустым...';
$myfm = mysql_query("SELECT * FROM `forum_m` WHERE `author`='".$user['id']."' ORDER BY `time` desc");
while($myfm2 = mysql_fetch_assoc($myfm)){
$myfm_timeout = $myfm2['time'];
if((time()-$myfm_timeout) < 5) $err[] = 'Писать можно только раз в 5 секунд...';
}
$forum_rep = mysql_fetch_array(mysql_query('select * from `forum_m` where `author` = "'.$user['id'].'" and `t` = "'.$id.'" and `text` = "'.$text.'"'));
if($forum_rep != 0) $err[] = 'Вы уже писали такое сообщение...';
/////////файлы .//////
if(@file_exists($_FILES['filename']['tmp_name'])){
if($_FILES['filename']['size'] != 0 and $_FILES['filename']['size'] > 1024000) $err[] = 'Слишком большой файл...';
$filetype = array ( 'jpg', 'gif', 'png', 'jpeg', 'bmp', 'zip', 'rar', '7z', 'txt' );
$upfiletype = substr($_FILES['filename']['name'], strrpos( $_FILES['filename']['name'], "." )+1);
if(!in_array($upfiletype,$filetype)) $err[] = 'Вы пытаетесь загрузить недопустимый формат файла...';
}
/////////файлы .//////
if(!$err){
if(@file_exists($_FILES['filename']['tmp_name'])) $fn = date('dmY').'_fn'.rand(1234,5678).'_'.$_FILES['filename']['name']; else $fn = NULL;
if(@file_exists($_FILES['filename']['tmp_name'])){
move_uploaded_file($_FILES['filename']['tmp_name'], "files/".$fn."");
}
mysql_query("INSERT INTO `forum_m`(
`r`,
`pr`,
`t`,
`author`,
`text`,
`time`,
`file`
)VALUES(
'".$forum_r['id']."',
'".$forum_pr['id']."',
'".$id."',
'".$user['id']."',
'[b]".$nick."[/b], ".$text."',
'".time()."',
'".$fn."'
)");
mysql_query("UPDATE `forum_t` SET `last`='".$user['id']."',`ltime`='".time()."' WHERE `id`='".$id."' limit 1");
$forum_m = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_m` WHERE `t`='".$id."'"),0);
mysql_query("INSERT INTO `op`(
`who`,
`ho`,
`text`,
`time`,
`read`,
`sort`
)VALUES(
'".$otv."',
'".$user['id']."',
'ответил вам в теме [url=/forum/t".$id."/p".ceil(($forum_m+1)/10)."]".$forum_t['name']."[/url]!',
'".time()."',
'0',
'3'
)");
header('Location: /forum/t'.$id.'/p'.ceil(($forum_m+1)/10).'');
$forum_rss = mysql_query("SELECT * FROM `forum_rss` WHERE `t`='".$id."'");
while($forum_rss2 = mysql_fetch_assoc($forum_rss)){
if($forum_rss2['who'] != $user['id'] && $forum_rss2['who'] != $otv2['id']){
mysql_query("INSERT INTO `op`(
`who`,
`ho`,
`text`,
`time`,
`read`,
`sort`
)VALUES(
'".$forum_rss2['who']."',
'".$user['id']."',
'ответил в теме [url=/forum/t".$forum_t['id']."/p".ceil(($forum_m+1)/10)."]".$forum_t['name']."[/url]!',
'".time()."',
'0',
'3'
)");
}
}
}else{
echo '<div class="err">';
foreach($err as $err_info){
echo $err_info.'<br>';
}
echo '</div>';
}
}
echo '<div class="post2">
Сообщение для <a href="/us'.$otv2['id'].'">'.uname($otv2['id']).'</a>:
<form action="/forum/t'.$id.'/otv'.$otv.'?" method="post">
<textarea name="text" style="width:98%;" rows="3"></textarea><br>
<input type="submit" value="Написать"/>
</form></div><div class="tegi"><img src="/modules/forum/images/alll.png"/> <a href="/forum/rul'.$forum_pr['id'].'" >Правила подраздела</a> | <img src="/modules/forum/images/emoc.png"/> <a href="/smiles.php" >Смайлы</a> | <img src="/modules/forum/images/cod.png"/> <a href="/bbcode.php" >ББ коды</a> | <img src="/modules/forum/images/usear.png"/> <a href="/forum/search" >Поиск</a></div>';
break;
/////////ответить .//////
/////////цитата .//////
case 'cit':
if(!$user['id']){
header('Location: ?'); exit;
}
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id)){
header('Location: ?'); exit;
}
$forum_m = mysql_fetch_array(mysql_query('select * from `forum_m` where `id` = "'.$id.'"'));
$forum_t = mysql_fetch_array(mysql_query('select * from `forum_t` where `id` = "'.$forum_m['t'].'"'));
$forum_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$forum_t['pr'].'"'));
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$forum_pr['r'].'"'));
if($forum_m['del2'] == 1){
header('Location: /forum/t'.$forum_m['t'].''); exit;
}
if($forum_t == 0){
header('Location: /forum'); exit;
}
if($forum_t['status'] == 1){
header('Location: /forum/t'.$forum_t['id'].''); exit;
}
if($forum_m['author'] == $user['id']){
header('Location: /forum/t'.$forum_t['id'].''); exit;
}
$cit2 = mysql_fetch_array(mysql_query('select * from `forum_m` where `id` = "'.$id.'" and `t` = "'.$forum_t['id'].'"'));
if($cit2 == 0){
header('Location: /forum/t'.$forum_t['id'].'');exit;
}
$cit2_author = mysql_fetch_array(mysql_query('select * from `user` where `id` = "'.$cit2['author'].'" '));
$nicks = mysql_query("SELECT * FROM `nicks` where `who` = '".$cit2_author['id']."' ORDER BY `id` DESC LIMIT 1");
while($nicks2 = mysql_fetch_assoc($nicks)){
$nick = $nicks2['new'];
}
if(empty($nick)) $nick = $us['login'];
echo ' <div class="tegi"><b><a href="?m=r&id='.$forum_pr['r'].'" >'.$forum_r['name'].'</a> | <a href="?m=pr&id='.$forum_pr['id'].'" >'.$forum_pr['name'].'</a> | <a href="?m=t&id='.$forum_t['id'].'" >'.$forum_t['name'].'</a></b></div></div>';
echo '</div>';
echo '<div class="start">';
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
echo '<div class="post1">Цитата: <a href="/us'.$cit2_author['id'].'">'.uname($cit2_author['id']).'</a>:<div class="cit">'.smiles(bbcode($cit2['text'])).'</div></div>';
if(isset($_POST['text'])){
$text = TextGuard($_POST['text']);
if(mysql_result(mysql_query('select count(`id`) from `forum_m` where `text` LIKE "%'.$text.'%" and `t` = "'.$id.'" limit 1'),0) != 0) $err[] = 'Вы уже писали это сообщение!';
if(empty($text)) $err[] = 'Сообщение осталось пустым...';
$myfm = mysql_query("SELECT * FROM `forum_m` WHERE `author`='".$user['id']."' ORDER BY `time` desc");
while($myfm2 = mysql_fetch_assoc($myfm)){
$myfm_timeout = $myfm2['time'];
if((time()-$myfm_timeout) < 5) $err[] = 'Писать можно только раз в 5 секунд...';
}
$forum_rep = mysql_fetch_array(mysql_query('select * from `forum_m` where `author` = "'.$user['id'].'" and `t` = "'.$forum_t['id'].'" and `text` = "'.$text.'"'));
if($forum_rep != 0) $err[] = 'Вы уже писали такое сообщение...';
/////////файл .//////
if(@file_exists($_FILES['filename']['tmp_name'])){
if($_FILES['filename']['size'] != 0 and $_FILES['filename']['size'] > 1024000) $err[] = 'Слишком большой файл...';
$filetype = array ( 'jpg', 'gif', 'png', 'jpeg', 'bmp', 'zip', 'rar', '7z', 'txt' );
$upfiletype = substr($_FILES['filename']['name'], strrpos( $_FILES['filename']['name'], "." )+1);
if(!in_array($upfiletype,$filetype)) $err[] = 'Вы пытаетесь загрузить недопустимый формат файла...';
}
/////////файл .//////
if(!$err){
if(@file_exists($_FILES['filename']['tmp_name'])) $fn = date('dmY').'_fn'.rand(1234,5678).'_'.$_FILES['filename']['name']; else $fn = NULL;
if(@file_exists($_FILES['filename']['tmp_name'])){
move_uploaded_file($_FILES['filename']['tmp_name'], "files/".$fn."");
}
mysql_query("INSERT INTO `forum_m`(
`r`,
`pr`,
`t`,
`author`,
`text`,
`cit`,
`time`,
`file`
)VALUES(
'".$forum_r['id']."',
'".$forum_pr['id']."',
'".$forum_t['id']."',
'".$user['id']."',
'".$text."',
'".$id."',
'".time()."',
'".$fn."'
)");
mysql_query("UPDATE `forum_t` SET `last`='".$user['id']."',`ltime`='".time()."' WHERE `id`='".$forum_t['id']."' limit 1");
$forum_m2 = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_m` WHERE `t`='".$forum_t['id']."'"),0);
mysql_query("INSERT INTO `op`(
`who`,
`ho`,
`text`,
`time`,
`read`
)VALUES(
'".$cit2_author['id']."',
'".$user['id']."',
'процитировал ваш пост:[br]".$cit2['text']." в теме [url=/forum/t".$forum_t['id']."/p".ceil(($forum_m2+1)/10)."]".$forum_t['name']."[/url]!',
'".time()."',
'0'
)");
header('Location: /forum/t'.$forum_t['id'].'/p'.ceil(($forum_m2+1)/10).'');
$forum_rss = mysql_query("SELECT * FROM `forum_rss` WHERE `t`='".$id."'");
while($forum_rss2 = mysql_fetch_assoc($forum_rss)){
if($forum_rss2['who'] != $user['id'] && $forum_rss2['who'] != $cit2_author['id']){
mysql_query("INSERT INTO `op`(
`who`,
`ho`,
`text`,
`time`,
`read`,
`sort`
)VALUES(
'".$forum_rss2['who']."',
'".$user['id']."',
'ответил в теме [url=/forum/t".$forum_t['id']."/p".ceil(($forum_m2+1)/10)."]".$forum_t['name']."[/url]!',
'".time()."',
'0',
'3'
)");
}
}
}else{
echo '<div class="err">';
foreach($err as $err_info){
echo $err_info.'<br>';
}
echo '</div>';
}
}
echo '<div class="post2">
<form action="/forum/cit'.$id.'" method="post" enctype="multipart/form-data">
Сообщение:<br><textarea name="text" style="width:98%;" rows="3"></textarea><br>
Файл:<br><input type="file" name="filename"/><br>
<input type="submit" value="Написать"/>
</form></div><div class="tegi"><img src="/modules/forum/images/emoc.png"/> <a href="/smiles.php" >Смайлы</a> | <img src="/modules/forum/images/cod.png"/> <a href="/bbcode.php" >ББ коды</a></div>';
break;
/////////цитата .//////
/////////новая тема .//////
case 'nt':
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id)){
header('Location: ?'); exit;
}
$forum_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$id.'"'));
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$forum_pr['r'].'"'));
if($forum_pr == 0){
header('Location: ?'); exit;
}
echo ' <div class="tegi"><b><a href="?m=r&id='.$forum_pr['r'].'" >'.$forum_r['name'].'</a> | <a href="?m=pr&id='.$forum_pr['id'].'" >'.$forum_pr['name'].'</a></b></div></div>';
echo '</div>';
echo '<div class="start">';
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
if(isset($_POST['submit'])){
$name = TextGuard($_POST['name']);
$text = TextGuard($_POST['text']);
$myfem = mysql_query("SELECT * FROM `forum_t` WHERE `author`='".$user['id']."' ORDER BY `time` desc");
while($myfem2 = mysql_fetch_assoc($myfem)){
$myfme_timeout = $myfem2['time'];
if((time()-$myfme_timeout) < 300) $err[] = 'Создавать темы можно раз в 5минут..';
}
$captcha = TextGuard($_POST['captcha']);
if(empty($captcha) or !is_numeric($captcha)) $err[] = 'Введите проверочный код.';
if($captcha != $_SESSION['control']) $err[] = 'Вы ввели неверный код с картинки.';
if(empty($text)) $err[] = 'Сообщение осталось пустым...';
if(empty($name)) $err[] = 'Название темы осталовь пустым...';
if(!$err){
mysql_query("INSERT INTO `forum_t`(
`r`,
`pr`,
`name`,
`status`,
`author`,
`last`,
`ltime`,
`time`
)VALUES(
'".$forum_r['id']."',
'".$forum_pr['id']."',
'".$name."',
'0',
'".$user['id']."',
'".$user['id']."',
'".time()."',
'".time()."'
)");
$tid = mysql_insert_id();
mysql_query("INSERT INTO `forum_m`(
`r`,
`pr`,
`t`,
`author`,
`text`,
`time`
)VALUES(
'".$forum_r['id']."',
'".$forum_pr['id']."',
'".$tid."',
'".$user['id']."',
'".$text."',
'".time()."'
)");
mysql_query("INSERT INTO `forum_rss`(
`t`,
`who`
)VALUES(
'".$tid."',
'".$user['id']."'
)");
header('Location: /forum/t'.$tid.'');
}else{
echo '<div class="err">';
foreach($err as $err_info){
echo $err_info.'<br>';
}
echo '</div>';
}
}
echo '<div class="post2">
<form action="?m=nt&id='.$id.'" method="post">
Тема:<br><input name="name"/><br>
Сообщение:<br><textarea name="text" style="width:98%;" rows="3"/></textarea><br>
Код <img src="/captcha.php" alt="'.$code.'"/>:<br><input name="captcha"/><br>
Ознакомьтесь с <a href="?m=rules&id='.$id.'">правилами</a> п.д!<br>
<input type="submit" value="Добавить" name="submit"/>
</form></div><div class="tegi"><img src="/modules/forum/images/emoc.png"/> <a href="/smiles.php" >Смайлы</a> | <img src="/modules/forum/images/cod.png"/> <a href="/bbcode.php" >ББ коды</a></div>';
break;
/////////новая тема .//////
/////////ред. поста .//////
case 'edit':
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id)){
header('Location: /forum/'); exit;
}
$forum_m = mysql_fetch_array(mysql_query('select * from `forum_m` where `id` = "'.$id.'"'));
if($forum_m == 0 or $forum_m['author'] != $user['id'] && $user['status'] < 1){
header('Location: /forum/t'.$forum_m['t'].''); exit;
}
if($forum_m['author'] != $user['id'] || $forum_m['author'] != $user['id'] and $user['status'] < 1){
header('Location: /forum/t'.$forum_m['t'].''); exit;
}
$forum_t = mysql_fetch_array(mysql_query('select * from `forum_t` where `id` = "'.$forum_m['t'].'"'));
$forum_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$forum_t['pr'].'"'));
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$forum_pr['r'].'"'));
if($forum_m['del2'] == 1){
header('Location: /forum/t'.$forum_m['t'].''); exit;
}
if($forum_t == 0){
header('Location: ?'); exit;
}
echo ' <div class="tegi"><b><a href="/forum/r'.$forum_pr['r'].'" >'.$forum_r['name'].'</a> | <a href="/forum/pr'.$forum_pr['id'].'" >'.$forum_pr['name'].'</a> | <a href="/forum/t'.$forum_t['id'].'" >'.$forum_t['name'].'</a></b></div></div>';
echo '</div>';
echo '<div class="start">';
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
if(isset($_POST['text'])){
$text = TextGuard($_POST['text']);
if(empty($text)) $err[] = 'Сообщение осталось пустым...';
if(!$err){
mysql_query("UPDATE `forum_m` SET `text`='".$text."' WHERE `id`='".$id."' limit 1");
///посл ред
mysql_query("INSERT INTO `forum_post_edit`(`post`,`user`,`message`,`time`)VALUES('".$forum_m['id']."','".$user['id']."','".$text."','".time()."')");
///посл ред
$forum_m = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_m` WHERE `t`='".$forum_t['id']."'"),0);
header('Location: /forum/t'.$forum_t['id'].'/p'.ceil(($forum_m+1)/10).''); exit;
}else{
echo '<div class="err">';
foreach($err as $err_info){
echo $err_info.'<br>';
}
echo '</div>';
}
}
echo '<div class="post2"><form action="" method="post">
Сообщение:<br><textarea name="text" style="width:98%;" rows="3">'.$forum_m['text'].'</textarea><br>
<input type="submit" value="Сохранить"/>
</form></div>';
break;
/////////ред. поста .//////
/////////поиск .//////
case 'search':
echo ' <div class="tegi"><b><a href="/forum" >Форум</a> | Поиск</b></div></div>';
echo '</div>';
echo '<div class="start">';
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
echo '<div class="post2">
<form action="/forum/search" method="post">
<input name="text"/><br>
Где искать?<br><select name="to"><option value="1">в темах</option><option value="2">в сообщениях</option></select><br>
<input type="submit" value="Поиск" name="submit"/>
</div>';
if(isset($_POST['submit'])){
echo '<div class="post2">Результаты поиска:</div>';
$text = TextGuard($text);
$to = TextGuard($to);
if(strlen($text) <2) $err[] = 'Минимальная длина звпроса 2 симлова...';
if(!$err){
$cop = $user['on_page'];
if($to == 1){
$ca = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_t` where `name` LIKE '%".$text."%'"),0);
$cp = ceil($ca/$cop);
if(isset($_GET['p']) && is_numeric($_GET['p'])){
$p = $_GET['p'];
if($_GET['p']>$cp) $p = $cp;
if($_GET['p']<1)$p = 1;
}else{
$p = 1;
}
$start = $p*$cop-$cop;
$search = mysql_query("SELECT * FROM `forum_t` where `name` LIKE '%".$text."%' ORDER BY `id` DESC LIMIT $start,$cop");
while($search2 = mysql_fetch_assoc($search)){
$search2_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$search2['r'].'"'));
$search2_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$search2['pr'].'"'));
echo '<div class="post1"><a href="/forum/r'.$search2_r['id'].'" >'.$search2_r['name'].'</a> | <a href="/forum/pr'.$search2_pr['id'].'" >'.$search2_pr['name'].'</a></div><div class="post2">';
if($search2['status'] == 0) echo '<img src="/modules/forum/images/the.png"/>';
elseif($search2['status'] == 1) echo '<img src="/modules/forum/images/closed.png"/>';
echo ' <a href="/forum/t'.$search2['id'].'">'.$search2['name'].'</a> ('.mysql_result(mysql_query('select count(`id`) from `forum_m` where `t` = "'.$search2['id'].'"'),0).') <a href="/forum/t'.$search2['id'].'/p'.ceil(((mysql_result(mysql_query('select count(`id`) from `forum_m` where `t` = "'.$search2['id'].'"'),0))+1)/10).'">></a><br>
'.ustatus($search2['author']).' <a href="/us'.$search2['author'].'">'.uname($search2['author']).'</a>/'.ustatus($search2['last']).' <a href="/us'.$search2['last'].'">'.uname($search2['last']).'</a> ('.times($search2['ltime']).')';
echo '</div>';
}
}elseif($to == 2){
$ca = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_m` where `text` LIKE '%".$text."%'"),0);
$cp = ceil($ca/$cop);
if(isset($_GET['p']) && is_numeric($_GET['p'])){
$p = $_GET['p'];
if($_GET['p']>$cp) $p = $cp;
if($_GET['p']<1)$p = 1;
}else{
$p = 1;
}
$start = $p*$cop-$cop;
$search = mysql_query("SELECT * FROM `forum_m` where `text` LIKE '%".$text."%' ORDER BY `id` DESC LIMIT $start,$cop");
while($search2 = mysql_fetch_assoc($search)){
$search2_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$search2['r'].'"'));
$search2_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$search2['pr'].'"'));
$search2_t = mysql_fetch_array(mysql_query('select * from `forum_t` where `id` = "'.$search2['t'].'"'));
echo '<div class="tegi"><a href="/forum/r'.$search2_r['id'].'" >'.$search2_r['name'].'</a> | <a href="/forum/pr'.$search2_pr['id'].'" >'.$search2_pr['name'].'</a> | <a href="/forum/t'.$search2_t['id'].'" >'.$search2_t['name'].'</a></div><div class="post2">'.ustatus($search2['author']).' <a href="/us'.$search2['author'].'"><b>'.uname($search2['author']).'</b></a> '.uaccess($search2['author']).' ('.times($search2['time']).')<br>';
if(!empty($search2['cit'])){
$cit = mysql_fetch_array(mysql_query('select * from `forum_m` where `id` = "'.$search2['cit'].'"'));
$cit_author = mysql_fetch_array(mysql_query('select * from `user` where `id` = "'.$cit['author'].'"'));
echo 'Цитата:<br><div class="cit"><b>'.$cit_author['login'].'</b>: '.smiles(bbcode($cit['text'])).'</div>';
}
echo ''.smiles(bbcode($search2['text'])).'
</div>';
}}
if($ca == 0) echo '<div class="err" align="center"><b>По вашему запросу ничего не найдено...</b></div>';
}else{
echo '<div class="err">';
foreach($err as $err_info){
echo $err_info.'<br>';
}
echo '</div>';
}
}
break;
/////////поиск .//////
/////////файлы в теме .//////
case 'files':
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id)){
header('Location: /forum'); exit;
}
$forum_t = mysql_fetch_array(mysql_query('select * from `forum_t` where `id` = "'.$id.'"'));
$forum_pr = mysql_fetch_array(mysql_query('select * from `forum_pr` where `id` = "'.$forum_t['pr'].'"'));
$forum_r = mysql_fetch_array(mysql_query('select * from `forum_r` where `id` = "'.$forum_pr['r'].'"'));
if($forum_t == 0 or $forum_pr == 0 or $forum_r == 0){
header('Location: /forum'); exit;
}
$forum_rss = mysql_fetch_array(mysql_query('select * from `forum_rss` where `t` = "'.$id.'" and `who` = "'.$user['id'].'" limit 1'));
$cop = $user['on_page'];
$ca = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_m` where `t` = '".$id."' and `file` != ''"),0);
$cp = ceil($ca/$cop);
if(isset($_GET['p']) && is_numeric($_GET['p']) && $ca != 0){
$p = $_GET['p'];
if($_GET['p']>$cp) $p = $cp;
if($_GET['p']<1)$p = 1;
}else{
$p = 1;
}
$start = $p*$cop-$cop;
echo ' <div class="tegi"><b>В теме "'.$forum_t['name'].'" '.$ca.' файлов</b></div></div>';
echo '</div>';
echo '<div class="start">';
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
if($ca != 0){
$forum_m = mysql_query("SELECT * FROM `forum_m` where `t` = '".$id."' and `file` != '' ORDER BY `id` DESC LIMIT $start,$cop");
while($forum_m2 = mysql_fetch_assoc($forum_m)){
echo '<div class="post2">'.ustatus($forum_m2['author']).' <a href="/us'.$forum_m2['author'].'">'.uname($forum_m2['author']).'</a> '.uaccess($forum_m2['author']).' <font color="gray">('.times($forum_m2['time']).')</font><br><a href="/modules/forum/files/'.$forum_m2['file'].'">'.$forum_m2['file'].'</a> ('.round(filesize('files/'.$forum_m2['file'].'')/1024).' кб)</b></div>';
}
echo '<div class="spis">Стр. ';
if($p-2>0) echo '<a href="/forum/t'.$id.'/files?p=1"><<</a> ';
if($p-1>0) echo '<a href="/forum/t'.$id.'/files?p='.($p-1).'"><</a> ';
if($p-3>0) echo '<a href="/forum/t'.$id.'/files?p='.($p-3).'">'.($p-3).'</a> | ';
if($p-2>0) echo '<a href="/forum/t'.$id.'/files?p='.($p-2).'">'.($p-2).'</a> | ';
if($p-1>0) echo '<a href="/forum/t'.$id.'/files?p='.($p-1).'">'.($p-1).'</a> | ';
echo '<b>'.$p.'</b>';
if($p+1<=$cp) echo ' | <a href="/forum/t'.$id.'/files?p='.($p+1).'">'.($p+1).'</a>';
if($p+2<=$cp) echo ' | <a href="/forum/t'.$id.'/files?p='.($p+2).'">'.($p+2).'</a>';
if($p+3<=$cp) echo ' | <a href="/forum/t'.$id.'/files?p='.($p+3).'">'.($p+3).'</a>';
if($p+1<=$cp) echo ' <a href="/forum/t'.$id.'/files?p='.($p+1).'">></a>';
if($p+2<=$cp) echo ' <a href="/forum/t'.$id.'/files?p='.ceil($ca/$cop).'">>></a>';
echo '</div>';
}else{
echo '<div class="err"><b>Файлов нет!</b></div>';
}
echo '<div class="levo"><a href="/forum/t'.$id.'">Назад</div>';
break;
/////////файлы темы .//////
/////////сказали спасибо .//////
case 'sps':
$id = TextGuard($_GET['id']);
if(empty($id) or !is_numeric($id)){
header('Location: ?'); exit;
}
$forum_t = mysql_fetch_array(mysql_query('select * from `forum_t` where `id` = "'.$id.'"'));
if($forum_t == 0){
header('Location: ?'); exit;
}
$in = mysql_result(mysql_query('select count(`id`) from `forum_t_thnx` where `t` = "'.$id.'"'),0);
echo ' <div class="tegi"><b>Сказали спасибо '.$in.' человек</b></div></div>';
echo '</div>';
echo '<div class="start">';
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include '../../system/nvg.php';
$cop = $user['on_page'];
$ca = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_t_thnx` WHERE `t`='".$id."'"),0);
$cp = ceil($ca/$cop);
if(isset($_GET['p']) && is_numeric($_GET['p'])){
$p = $_GET['p'];
if($_GET['p']>$cp) $p = $cp;
if($_GET['p']<1)$p = 1;
}else{
$p = 1;
}
$start = $p*$cop-$cop;
if($ca > 0){
$tht = mysql_query("SELECT * FROM `forum_t_thnx` WHERE `t`='".$id."' ORDER BY `time` desc LIMIT $start,$cop");
while($txt2 = mysql_fetch_assoc($tht)){
echo '<div class="post2">'.ustatus($txt2['user']).' <a href="/us'.$txt2['user'].'">'.uname($txt2['user']).'</a> '.uaccess($txt2['user']).' ('.times($txt2['time']).')</div>';
}}else{
echo '';
}
echo '<div class="spis">Стр. ';
if($p-2>0) echo '<a href="/forum/t'.$id.'/sps/p1"><<</a> ';
if($p-1>0) echo '<a href="/forum/t'.$id.'/sps/p'.($p-1).'"><</a> ';
if($p-3>0) echo '<a href="/forum/t'.$id.'/sps/p'.($p-3).'">'.($p-3).'</a> | ';
if($p-2>0) echo '<a href="/forum/t'.$id.'/sps/p'.($p-2).'">'.($p-2).'</a> | ';
if($p-1>0) echo '<a href="/forum/t'.$id.'/sps/p'.($p-1).'">'.($p-1).'</a> | ';
echo '<b>'.$p.'</b>';
if($p+1<=$cp) echo ' | <a href="/forum/t'.$id.'/sps/p'.($p+1).'">'.($p+1).'</a>';
if($p+2<=$cp) echo ' | <a href="/forum/t'.$id.'/sps/p'.($p+2).'">'.($p+2).'</a>';
if($p+3<=$cp) echo ' | <a href="/forum/t'.$id.'/sps/p'.($p+3).'">'.($p+3).'</a>';
if($p+1<=$cp) echo ' <a href="/forum/t'.$id.'/sps/p'.($p+1).'">></a>';
if($p+2<=$cp) echo ' <a href="/forum/t'.$id.'/sps/p'.ceil($ca/$cop).'">>></a>';
echo '</div><div class="levo"><a href="/forum/t'.$id.'">Назад</a></div>';
break;
/////////сказали спасибо .//////
}
include '../../system/footer.php';
?>