Файл: in4at/forum.php
Строк: 260
<?php
##################################################################################################
## Script name : In4at ##
## Version : Final ##
## Made by : XPYCT(Сергей Мищенко) ##
## E-mail : bce-ok@bk.ru ##
## ICQ : 447-50-50-62 ##
## Site : http://vkontakte.ru/id31604521 ##
## Внимание! Скрипт распространяется бесплатно! Модификация W4at by XPYCT ##
##################################################################################################
define('REQ_2_chat', true);
require('4at_set.php');
require('db_con.php');
require('style.php');
if ($py !== spy_code) require('us_info.php');
function getmicrotime()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$time = getmicrotime();
mysql_query("Update users set onl='".$time."', room='f' where id ='".$id."' LIMIT 1;");
$cm = mysql_query("select count(id) as num from forum WHERE 1;");
$cmc = mysql_fetch_array($cm);
$news = $cmc['num'];
echo head;
if ($mod=='sm'){
if ($vv!=0) echo '<div class="d0"><b>Смайлы</b></div>';
else echo '<card id="news" title="Смайлы"><p>';
echo $fsize1;
echo ":) <img src="smilef/ab.gif" alt=":)"/><br/>";
echo ":( <img src="smilef/ac.gif" alt=":("/><br/>";
echo ";) <img src="smilef/ad.gif" alt=";)"/><br/>";
echo ":-D <img src="smilef/ag.gif" alt=":-D"/><br/>";
echo "8-) <img src="smilef/af.gif" alt="8-)"/><br/>";
echo ".angel. <img src="smilef/aa.gif" alt=".angel."/><br/>";
echo ":-P <img src="smilef/ae.gif" alt=":-P"/><br/>";
echo ":-[ <img src="smilef/ah.gif" alt=":-["/><br/>";
echo "=-0 <img src="smilef/ai.gif" alt="=-0"/><br/>";
echo ":-* <img src="smilef/aj.gif" alt=":-*"/><br/>";
echo ".uh. <img src="smilef/am.gif" alt=".uh."/><br/>";
echo ".tss. <img src="smilef/al.gif" alt=".tss."/><br/>";
echo ".che. <img src="smilef/an.gif" alt=".che."/><br/>";
echo ".obida. <img src="smilef/ao.gif" alt=".obida."/><br/>";
echo ".he. <img src="smilef/ap.gif" alt=".he."/><br/>";
echo divide;
echo '<a href="forum.php?'.$wp.'&mod=sm2">Далее</a><br/>';
echo divide;
echo '<a href="forum.php?'.$wp.'">Форум</a><br/>';
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
if ($mod=='sm2'){
if ($vv!=0) echo '<div class="d0"><b>Смайлы</b></div>';
else echo '<card id="news" title="Смайлы"><p>';
echo $fsize1;
echo ".diablo. <img src="smilef/aq.gif" alt=".diablo."/><br/>";
echo ".music. <img src="smilef/ar.gif" alt=".music."/><br/>";
echo ".kiss. <img src="smilef/ap.gif" alt=".kiss."/><br/>";
echo ".be. <img src="smilef/at.gif" alt=".be."/><br/>";
echo ".ustal. <img src="smilef/au.gif" alt=".ustal."/><br/>";
echo ".stop. <img src="smilef/av.gif" alt=".stop."/><br/>";
echo ".kissyou. <img src="smilef/aw.gif" alt=".kissyou."/><br/>";
echo ".rose. <img src="smilef/ax.gif" alt=".rose."/><br/>";
echo ".ok. <img src="smilef/ay.gif" alt=".ok."/><br/>";
echo ".pivo. <img src="smilef/az.gif" alt=".pivo."/><br/>";
echo ".love. <img src="smilef/ba.gif" alt=".love."/><br/>";
echo ".lol. <img src="smilef/bj.gif" alt=".lol."/><br/>";
echo ".dance. <img src="smilef/bo.gif" alt=".dance."/><br/>";
echo ".crazy. <img src="smilef/bm.gif" alt=".crazy."/><br/>";
echo divide;
echo '<a href="forum.php?'.$wp.'&mod=sm">Назад</a><br/>';
echo divide;
echo '<a href="forum.php?'.$wp.'">Форум</a><br/>';
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
if ($mod=='mes'){
$pr = mysql_query("select * from forum_t WHERE id=$mid;");
$enter = mysql_fetch_array($pr);
$wh = mysql_query("select user from users WHERE id='".$enter['who']."';");
$who = mysql_fetch_array($wh);
if ($vv!=0) echo '<div class="d0"><b>'.$enter['title'].'</b></div>';
else echo '<card id="news" title="'.$enter['title'].'"><p>';
echo $fsize1;
echo'Coобщение: <b>'.$enter['mes'].'</b><br/>[<u>'.$enter['time'].', '.$enter['data'].'</u>]<br/>|<a href="search.php?go=view&'.$wp.'&nk='.$enter['who'].'">'.$who['user'].'</a>|<br/>---<br/>';
if(empty($page)) $page=0;
$query = mysql_query("select * from `forum_m` WHERE tem=$mid; ");
$num_of_rows=mysql_num_rows($query);
$total_mat_number=$num_of_rows;
$mat_per_page=10;
$total_pages=ceil($total_mat_number/$mat_per_page);
$print = mysql_query("select * from `forum_m` WHERE tem=$mid order by id limit ".$page.",".($mat_per_page).";");
if (mysql_affected_rows() == 0) {
echo 'Сообщений нет<br/>';
}
while($arr = mysql_fetch_array($print)) {
require('sm.php');
$wh = mysql_query("select user from users WHERE id='".$arr['who']."';");
$who = mysql_fetch_array($wh);
echo "[".$arr['id']."] » <a href="search.php?go=view&$wp&nk=".$arr['who'].""><b>".$who['user']."</b></a><br/>[".$arr['time'].", ".$arr['data']."]<br/>>n";
echo "".$arr['mes']."<br/>";
if($row['posts']>499){echo "<a href="forum.php?$wp&mod=otvmes&mid=".$arr['id']."&umid=".$arr['who']."&mid2=".$mid."">[Отв]</a>|<a href="forum.php?$wp&mod=citmes&mid=".$arr['id']."&mid2=".$mid."&umid=".$arr['who']."">[Цит]</a><br/>";}
if(($arr['who']==$id)||($row['level']==7)){echo "<a href="forum.php?$wp&mod=editmes&mid=".$arr['id']."&mid2=".$mid."">[Изм]</a>|<a href="forum.php?$wp&mod=delmes&mid=".$arr['id']."&mid2=".$mid."">[Уд]</a><br/>";}
echo divide;}
for ($v=0;$v<$total_pages;$v++){
$page_number=$v*$mat_per_page;
if ($page_number!=$page) {
echo "<a href="forum.php?$wp&page=$page_number&mod=mes&mid=".$mid."">|".($v+1)."|</a> ";
} else {
echo '|<b>'.($v+1).'</b>| ';
}
}
if($enter['zak']!=1){
if($row['posts']>499){
if($vv!=0) echo "<form action="forum.php?$wp&mod=addmes&action=add&mid=$mid" method="post">";
echo '<br/>Текст:<br/>';
require('smile.php');
echo "<input name="mes$ref"/><br/>";
if($vv!=0){
echo "<input class="ibutton" type="submit" value="Ответить"/></form>";
}else{
echo "<anchor>Ответить<go href="forum.php?$wp&mod=addmes&action=add&mid=$mid" method="post">";
echo "<postfield name="mes" value="$(mes$ref)"/>";
echo '</go></anchor><br/>';
}}}else{echo'<b>Тема закрыта!</b><br/>';}
echo '<br/>';
echo divide;
echo '<a href="forum.php?'.$wp.'">Форум</a><br/>';
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
if ($mod=='delmes'){
$pr = mysql_query("select who from forum_m WHERE id=$mid;");
$enter = mysql_fetch_array($pr);
if ($vv!=0) echo '<div class="d0"><b>Удалить</b></div>';
else echo '<card id="news" title="Удалить"><p>';
echo $fsize1;
if(($enter['who']==$id)||($row['level']==7)){
if(mysql_query("delete from forum_m where id='$mid' limit 1;")){
echo '<b>Cooбщение удалено!</b><br/>';}
}else{echo '<b>Cooбщение не удалено!</b><br/>';}
echo divide;
echo "<a href="forum.php?$wp&mod=mes&mid=".$mid2."">Назад</a><br/>";
echo '<a href="forum.php?'.$wp.'">Форум</a><br/>';
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
if ($mod=='editmes'){
$pr = mysql_query("select who from forum_m WHERE id=$mid;");
$enter = mysql_fetch_array($pr);
if ($vv!=0) echo '<div class="d0"><b>Изменить</b></div>';
else echo '<card id="news" title="Изменить"><p>';
if(($enter['who']==$id)||($row['level']==7)){
$set=mysql_fetch_array(mysql_query("Select * from forum_m where id=$mid;"));
if(empty($action)){
if($vv!=0) echo "<form action="forum.php?$wp&mod=editmes&action=add&mid=$mid&mid2=$mid2" method="post">";
echo $fsize1;
echo 'Сообщение:<br/>';
echo $fsize2;
echo "<input name="mes$ref" value="".$set["mes"].""/><br/>";
if($vv!=0){
echo "<input class="ibutton" type="submit" value="Изменить"/></form>";
}else{
echo $fsize1;
echo "<anchor>Изменить<go href="forum.php?$wp&mod=editmes&action=add&mid=$mid&mid2=$mid2" method="post">";
echo "<postfield name="mes" value="$(mes$ref)"/>";
echo '</go></anchor><br/>';
}
}else{
mysql_query("Update forum_m set mes='".check($mes)."' where id =$mid");
echo $fsize1;
echo '<b>Cooбщение обновленo!</b><br/>';
}
}else{echo $fsize1;echo '<b>Cooбщение не обновленo!</b><br/>';}
echo divide;
echo "<a href="forum.php?$wp&mod=mes&mid=".$mid2."">Назад</a><br/>";
echo '<a href="forum.php?'.$wp.'">Форум</a><br/>';
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
if ($mod=='addmes'){
$time = date("H:i");
$data= date("d.m.Y");
$pr = mysql_query("select title from forum_t WHERE id=$mid;");
$enter = mysql_fetch_array($pr);
if ($vv!=0) echo '<div class="d0"><b>'.$enter['title'].'-Ответить</b></div>';
else echo '<card id="news" title="'.$enter['title'].'-Ответить"><p>';
if($row['posts']>499){
$za = mysql_query("select zak from forum_t WHERE id=$mid;");
$zak = mysql_fetch_array($za);
if($zak['zak']!=1){
$pr = mysql_query("select mes from forum_m order by id desc limit 1");
$enter = mysql_fetch_array($pr);
if($enter['mes']!=$mes){
$mes=check($mes);
if($row['translit']==1) $mes=trun_to_rus($mes);
mysql_query("insert into forum_m values(0,'$mid','$id','$mes','$data','$time');");
echo $fsize1;
echo '<b>Cообщение добавлено!</b><br/>';
echo $fsize2;
}else{
echo $fsize1;
echo '<b>Такое сообщение уже есть!</b><br/>';
echo $fsize2;}
}}
echo $fsize1;
echo divide;
echo "<a href="forum.php?$wp&mod=mes&mid=".$mid."">Назад</a><br/>";
echo '<a href="forum.php?'.$wp.'">Форум</a><br/>';
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
if ($mod=='otvmes'){
$time = date("H:i");
$data= date("d.m.Y");
if ($vv!=0) echo '<div class="d0"><b>Ответить</b></div>';
else echo '<card id="news" title="Ответить"><p>';
$za = mysql_query("select zak from forum_t WHERE id=$mid;");
$zak = mysql_fetch_array($za);
if($zak['zak']!=1){
if($row['posts']>499){
$pr2 = mysql_query("select user from users WHERE id='".$umid."';");
$enter2 = mysql_fetch_array($pr2);
if(empty($action)){
if($vv!=0) echo "<form action="forum.php?$wp&mod=otvmes&action=add&mid=$mid&mid2=".$mid2."" method="post">";
echo $fsize1;
echo 'Сообщение:<br/>';
echo $fsize2;
echo "<input name="mes$ref" value="".$enter2['user'].", "/><br/>";
if($vv!=0){
echo "<input class="ibutton" type="submit" value="Ответить"/></form>";
}else{
echo "<anchor>Ответить<go href="forum.php?$wp&mod=otvmes&action=add&mid=$mid&mid2=".$mid2."" method="post">";
echo "<postfield name="mes" value="$(mes$ref)"/>";
echo '</go></anchor><br/>';
}
}else{
$pr = mysql_query("select mes from forum_m order by id desc limit 1");
$enter = mysql_fetch_array($pr);
if($enter['mes']!=$mes){
$mes=check($mes);
if($row['translit']==1) $mes=trun_to_rus($mes);
mysql_query("insert into forum_m values(0,'$mid2','$id','$mes','$data','$time');");
echo $fsize1;
echo '<b>Cообщение добавлено!</b><br/>';
echo $fsize2;
}else{
echo $fsize1;
echo '<b>Такое сообщение уже есть!</b><br/>';
echo $fsize2;}
}}}
echo $fsize1;
echo divide;
echo "<a href="forum.php?$wp&mod=mes&mid=".$mid2."">Назад</a><br/>";
echo '<a href="forum.php?'.$wp.'">Форум</a><br/>';
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
if ($mod=='citmes'){
$time = date("H:i");
$data= date("d.m.Y");
if ($vv!=0) echo '<div class="d0"><b>Ответить</b></div>';
else echo '<card id="news" title="Ответить"><p>';
$za = mysql_query("select zak from forum_t WHERE id=$mid;");
$zak = mysql_fetch_array($za);
if($zak['zak']!=1){
if($row['posts']>499){
$pr1 = mysql_query("select user from users WHERE id='".$umid."';");
$enter1 = mysql_fetch_array($pr1);
$pr2 = mysql_query("select mes from forum_m WHERE id='".$mid."';");
$enter2 = mysql_fetch_array($pr2);
if(empty($action)){
if($vv!=0) echo "<form action="forum.php?$wp&mod=citmes&action=add&mid=$mid&mid2=".$mid2."" method="post">";
echo $fsize1;
echo 'Сообщение:<br/>';
echo $fsize2;
echo "<input name="mes$ref" value=""".$enter1['user'].">".$enter2['mes']."" "/><br/>";
if($vv!=0){
echo "<input class="ibutton" type="submit" value="Ответить"/></form>";
}else{
echo "<anchor>Ответить<go href="forum.php?$wp&mod=citmes&action=add&mid=$mid&mid2=".$mid2."" method="post">";
echo "<postfield name="mes" value="$(mes$ref)"/>";
echo '</go></anchor><br/>';
}
}else{
$pr = mysql_query("select mes from forum_m order by id desc limit 1");
$enter = mysql_fetch_array($pr);
if($enter['mes']!=$mes){
$mes=check($mes);
if($row['translit']==1) $mes=trun_to_rus($mes);
mysql_query("insert into forum_m values(0,'$mid2','$id','$mes','$data','$time');");
echo $fsize1;
echo '<b>Cообщение добавлено!</b><br/>';
echo $fsize2;
}else{
echo $fsize1;
echo '<b>Такое сообщение уже есть!</b><br/>';
echo $fsize2;}
}}}
echo $fsize1;
echo divide;
echo "<a href="forum.php?$wp&mod=mes&mid=".$mid2."">Назад</a><br/>";
echo '<a href="forum.php?'.$wp.'">Форум</a><br/>';
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
if ($mod=='addtem'){
$time = date("H:i");
$data= date("d.m.Y");
$pr = mysql_query("select title from forum WHERE id=$mid;");
$enter = mysql_fetch_array($pr);
if ($vv!=0) echo '<div class="d0"><b>'.$enter['title'].'-Добавить тему</b></div>';
else echo '<card id="news" title="'.$enter['title'].'-Добавить тему"><p>';
if($row['posts']>499){
if(empty($action)){
echo $fsize1;
echo 'Название темы:<br/>';
echo $fsize2;
if($vv!=0) echo "<form action="forum.php?$wp&mod=addtem&action=add&mid=$mid" method="post">";
echo "<input name="title$ref"/><br/>";
echo $fsize1;
echo 'Сообщение:<br/>';
echo $fsize2;
echo "<input name="mes$ref"/><br/>";
if($vv!=0){
echo "<input class="ibutton" type="submit" value="Добавить"/></form>";
}else{
echo "<anchor>Добавить<go href="forum.php?$wp&mod=addtem&action=add&mid=$mid" method="post">";
echo "<postfield name="title" value="$(title$ref)"/>";
echo "<postfield name="mes" value="$(mes$ref)"/>";
echo '</go></anchor><br/>';
}
}else{
$pr = mysql_query("select title from forum_t order by id desc limit 1");
$enter = mysql_fetch_array($pr);
if($enter['title']!=$title){
$title=check($title);
$mes=check($mes);
if($row['translit']==1) $title=trun_to_rus($title);
if($row['translit']==1) $mes=trun_to_rus($mes);
mysql_query("insert into forum_t values(0,'$mid','$id','$mes','$title',0,0,'$data','$time');");
echo $fsize1;
echo '<b>Тема добавлена!</b><br/>';
echo $fsize2;
}else{
echo $fsize1;
echo '<b>Такая тема уже есть!</b><br/>';
echo $fsize2;}
}}
echo $fsize1;
echo divide;
echo "<a href="forum.php?$wp&mod=tem&mid=".$mid."">Назад</a><br/>";
echo '<a href="forum.php?'.$wp.'">Форум</a><br/>';
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
if ($mod=='deltem'){
$pr = mysql_query("select who from forum_t WHERE id=$mid;");
$enter = mysql_fetch_array($pr);
if ($vv!=0) echo '<div class="d0"><b>Удалить</b></div>';
else echo '<card id="news" title="Удалить"><p>';
echo $fsize1;
if(($enter['who']==$id)||($row['level']==7)){
if(mysql_query("delete from forum_t where id='$mid' limit 1;")){
echo '<b>Тема удалена!</b><br/>';}
if(mysql_query("delete from forum_m where tem='$mid';")){
echo '<b>Сообщения удалены!</b><br/>';}
}else{echo '<b>Тема не удалена!</b><br/>';}
echo divide;
echo '<a href="forum.php?'.$wp.'">Форум</a><br/>';
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
if ($mod=='edittem'){
$pr = mysql_query("select who from forum_t WHERE id=$mid;");
$enter = mysql_fetch_array($pr);
if ($vv!=0) echo '<div class="d0"><b>Изменить</b></div>';
else echo '<card id="news" title="Изменить"><p>';
echo $fsize1;
if(($enter['who']==$id)||($row['level']==7)){
$set=mysql_fetch_array(mysql_query("Select * from forum_t where id=$mid;"));
if(empty($action)){
echo 'Название:<br/>';
echo $fsize2;
if($vv!=0) echo "<form action="forum.php?$wp&mod=edittem&action=add&mid=$mid" method="post">";
echo "<input name="title$ref" value="".$set["title"].""/><br/>";
echo $fsize1;
echo 'Сообщение:<br/>';
echo $fsize2;
echo "<input name="mes$ref" value="".$set["mes"].""/><br/>";
if($vv!=0){
echo "<input class="ibutton" type="submit" value="Изменить"/></form>";
echo $fsize1;
}else{
echo $fsize1;
echo "<anchor>Изменить<go href="forum.php?$wp&mod=edittem&action=add&mid=$mid" method="post">";
echo "<postfield name="title" value="$(title$ref)"/>";
echo "<postfield name="mes" value="$(mes$ref)"/>";
echo '</go></anchor><br/>';
}
}else{
mysql_query("Update forum_t set title='".check($title)."', mes='".check($mes)."' where id =$mid");
echo '<b>Тема обновлена!</b><br/>';
}
}else{echo '<b>Тема не обновлена!</b><br/>';}
echo divide;
echo '<a href="forum.php?'.$wp.'">Форум</a><br/>';
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
if ($mod=='skr'){
if ($vv!=0) echo '<div class="d0"><b>Закрепить</b></div>';
else echo '<card id="news" title="Закрепить"><p>';
echo $fsize1;
if($row['level']==7){
mysql_query("Update forum_t set skr='1' where id =$mid");
echo '<b>Тема закреплена</b><br/>';
}else{echo '<b>Тема не закреплена!</b><br/>';}
echo "<a href="forum.php?$wp&mod=tem&mid=".$mid2."">Назад</a><br/>";
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
if ($mod=='otkrep'){
if ($vv!=0) echo '<div class="d0"><b>Открепить</b></div>';
else echo '<card id="news" title="Открепить"><p>';
echo $fsize1;
if($row['level']==7){
mysql_query("Update forum_t set skr='0' where id =$mid");
echo '<b>Тема откреплена</b><br/>';
}else{echo '<b>Тема не откреплена!</b><br/>';}
echo "<a href="forum.php?$wp&mod=tem&mid=".$mid2."">Назад</a><br/>";
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
if ($mod=='zak'){
$pr = mysql_query("select who from forum_t WHERE id=$mid;");
$enter = mysql_fetch_array($pr);
if ($vv!=0) echo '<div class="d0"><b>Закрыть</b></div>';
else echo '<card id="news" title="Закрыть"><p>';
echo $fsize1;
if(($enter['who']==$id)||($row['level']==7)){
mysql_query("Update forum_t set zak='1' where id =$mid");
echo '<b>Тема закрыта</b><br/>';
}else{echo '<b>Тема не закрыта!</b><br/>';}
echo "<a href="forum.php?$wp&mod=tem&mid=".$mid2."">Назад</a><br/>";
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
if ($mod=='otkr'){
$pr = mysql_query("select who from forum_t WHERE id=$mid;");
$enter = mysql_fetch_array($pr);
if ($vv!=0) echo '<div class="d0"><b>Открыть</b></div>';
else echo '<card id="news" title="Открыть"><p>';
echo $fsize1;
if(($enter['who']==$id)||($row['level']==7)){
mysql_query("Update forum_t set zak='0' where id =$mid");
echo '<b>Тема открыта</b><br/>';
}else{echo '<b>Тема не открыта!</b><br/>';}
echo "<a href="forum.php?$wp&mod=tem&mid=".$mid2."">Назад</a><br/>";
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
if ($mod=='tem'){
$pr = mysql_query("select title from forum WHERE id=$mid;");
$enter = mysql_fetch_array($pr);
if ($vv!=0) echo '<div class="d0"><b>'.$enter['title'].'</b></div>';
else echo '<card id="news" title="'.$enter['title'].'"><p>';
echo $fsize1;
if(empty($page)) $page=0;
$query = mysql_query("select * from `forum_t` WHERE raz=$mid; ");
$num_of_rows=mysql_num_rows($query);
$total_mat_number=$num_of_rows;
$mat_per_page=10;
$total_pages=ceil($total_mat_number/$mat_per_page);
$print = mysql_query("select * from `forum_t` WHERE raz=$mid order by skr desc limit ".$page.",".($mat_per_page).";");
if (mysql_affected_rows() == 0) {
echo 'Тем нет...<br/>';
}
while($arr = mysql_fetch_array($print)) {
$us = mysql_query("select user from users WHERE id='".$arr['who']."';");
$usn = mysql_fetch_array($us);
echo'•';
if($arr['skr']==1)echo'<img src="icon_clip.gif" alt="закреплено"/>';
if($arr['zak']==1)echo'<b>#</b>';
$bl = mysql_fetch_array(mysql_query("select count(id) as num from forum_m where tem='".$arr['id']."'"));
$kol = $bl['num'];
echo "<a href="forum.php?$wp&mod=mes&mid=".$arr['id']."">".$arr['title']."($kol)</a><br/>[".$arr['time'].", ".$arr['data']."]|".$usn['user']."|<br/>";
if(($arr['who']==$id)||($row['level']==7)){
echo "<small><a href="forum.php?$wp&mod=edittem&mid=".$arr['id']."">[Ред]</a></small>";
if($row['level']==7)echo "<small>|<a href="forum.php?$wp&mod=deltem&mid=".$arr['id']."">[Уд]</a><br/></small>";
if($arr['zak']==0){echo "<small><a href="forum.php?$wp&mod=zak&mid=".$arr['id']."&mid2=".$mid."">[Закрыть]</a></small>";
}else{
if($row['level']==7)echo "<small><a href="forum.php?$wp&mod=otkr&mid=".$arr['id']."&mid2=".$mid."">[Открыть]</a></small>";}
echo'<br/>';
}
if($row['level']==7){
if($arr['skr']==0){echo "<small><a href="forum.php?$wp&mod=skr&mid=".$arr['id']."&mid2=".$mid."">[Закрепить]</a></small>";
}else{
echo "<small><a href="forum.php?$wp&mod=otkrep&mid=".$arr['id']."&mid2=".$mid."">[Открепить]</a><br/></small>";}
echo'<br/>';
}
echo divide;}
for ($v=0;$v<$total_pages;$v++){
$page_number=$v*$mat_per_page;
if ($page_number!=$page) {
echo "<a href="forum.php?$wp&page=$page_number&mod=tem&mid=".$mid."">|".($v+1)."|</a> ";
} else {
echo '|<b>'.($v+1).'</b>| ';
}
}
echo '<br/>'.divide;
if($row['posts']>499)echo "<a href="forum.php?$wp&mod=addtem&mid=".$mid."">Добавить тему</a><br/>---<br/>";
echo '<a href="forum.php?'.$wp.'">Форум</a><br/>';
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
if ($vv!=0) echo '<div class="d0"><b>Форум</b></div>';
else echo '<card id="news" title="Форум"><p>';
echo $fsize1;
$f = mysql_fetch_array(mysql_query("select count(id) as num from forum"));
$fk = $f['num'];
echo'<b>Наш Форум</b><br/>';
echo'<u>Разделов:</u><b>'.$fk.'</b><br/>';
$f = mysql_fetch_array(mysql_query("select count(id) as num from forum_t"));
$fk = $f['num'];
echo'<u>Тем:</u><b>'.$fk.'</b><br/>';
$f = mysql_fetch_array(mysql_query("select count(id) as num from forum_m"));
$fk = $f['num'];
echo'<u>Сообщений:</u><b>'.$fk.'</b><br/>';
$tm = time()-300;
if ($row['level'] < 7){
$pr_count = mysql_query("SELECT id FROM users WHERE (onl> '".$tm ."' and room='f') and (inv != 1)");
} else {
$pr_count = mysql_query("SELECT id FROM users WHERE onl> '".$tm ."' AND room='f'");
}
$kolpe = mysql_affected_rows();
echo '<a href="fwho.php?'.$wp.'">Kтo тут('.$kolpe.')</a>|<a href="who.php?'.$wp.'">Kтo где?</a><br/>';
echo '<a href="fsearch.php?'.$wp.'&mode=top&go=results">10 Новых тем</a><br/><a href="fsearch.php?'.$wp.'&mode=top2&go=results">10 Новых сообщений</a><br/><a href="fsearch.php?'.$wp.'">Поиск</a>|<a href="fsearch.php?'.$wp.'&mode=us&mes='.$id.'&go=results">Ваши темы</a><br/><a href="fsearch.php?'.$wp.'&mode=us2&mes='.$id.'&go=results">Ваши cообщения</a><br/>';
echo divide;
echo'<b>Разделы:</b><br/>';
if(empty($page)) $page=0;
$query = mysql_query("select * from `forum`");
$num_of_rows=mysql_num_rows($query);
$total_mat_number=$num_of_rows;
$mat_per_page=10;
$total_pages=ceil($total_mat_number/$mat_per_page);
$print = mysql_query("select * from `forum` order by id desc limit ".$page.",".($mat_per_page).";");
if (mysql_affected_rows() == 0) {
echo 'Форум пуст...<br/>';
}
while($arr = mysql_fetch_array($print)) {
$bl = mysql_fetch_array(mysql_query("select count(id) as num from forum_t where raz='".$arr['id']."'"));
$tm = $bl['num'];
echo "→ <a href="forum.php?$wp&mod=tem&mid=".$arr['id']."">".$arr['title']."</a>[$tm]<br/>";}
for ($v=0;$v<$total_pages;$v++){
$page_number=$v*$mat_per_page;
if ($page_number!=$page) {
echo "<a href="forum.php?$wp&page=$page_number">|".($v+1)."|</a> ";
} else {
echo '|<b>'.($v+1).'</b>| ';
}
}
echo '<br/>'.divide;
echo '<a href="forum.php?'.$wp.'&mod=sm">Список смайлов</a><br/>';
echo divide;
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo '---<br/>© XPYCT<br/>';
echo $fsize2;
echo foot;
mysql_close($link);
?>