Файл: sumerki.mobi/sumerki.mobi/forum/topic.php
Строк: 111
<?php
//////////////////////////////////////////////////////////////
//////////////////////Онлайн игра "Сумерки"///////////////////
//////////////////////Основатель: Mc Laren////////////////////
///////////////////Контакты: ICQ - 597687549//////////////////
/////////////////////Пример: Sumerki.Mobi/////////////////////
///////////Если ты это читаешь, значит скрипт слили :D////////
//////////////////////////////////////////////////////////////
define('PROTECTOR', 1);
$path = '../'; //путь
$textl = 'Форум';
include($path.'files/gzips.php');
include($path.'files/db.php');
include($path.'files/auth.php');
include($path.'files/func.php');
include($path . 'files/core.php');
include($path.'files/head.php');
$q = mysql_query("SELECT COUNT(*) FROM `msg_ticket` WHERE `user_to` = '$log' AND `read` = '1';");
$new_mail = mysql_result($q, 0);if($new_mail > 0){
echo"<a href="../ticket.php?mod=read"> <img src='../pic/main/sms.gif' alt='*'/></a> $new_mail";
}
echo'</div>';
$q = mysql_query("SELECT COUNT(*) FROM `msg_r` WHERE `user_to` = '$log' AND `read` = '1';");
$new_mail = mysql_result($q, 0);if($new_mail > 0){
echo "<hr>";
echo"<center><a href="../ps.php?mod=read"> Почта </a>+ $new_mail</center><hr>";
}
$id = intval($_GET['id']);
$topic = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_topics` WHERE `id` = '$id'"));
if(isset($topic['id'])){
if($udata[prava]=="5"){
echo '<div class="fon bg"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
if($topic['closed'] == 0){
echo '<div><center><a href="posting.php?act=topic_close&id='.$id.'">Закрыть</a> | <a href="posting.php?act=topic_edit&id='.$id.'">Редактировать</a> | <a href="posting.php?act=topic_del&id='.$id.'">Удалить</a></center>';
}}
echo '</div></div></div></div></div></div></div></div></div>';
if(isset($topic['id'])){
if($udata[prava]=="2"){
if($topic['closed'] == 0){
echo '<div><center><a href="posting.php?act=topic_close&id='.$id.'">Закрыть</a> | <a href="posting.php?act=topic_del&id='.$id.'">Удалить</a></center>';
echo '</div></div></div></div></div></div></div></div></div>';
}}}
echo '</div></div></div></div></div></div></div></div></div>';
echo'<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">'.$topic['title'].'</div><div class="clearFix"></div></div></div></div>';
function smiles($msg){
$dir = opendir ("../pic/smiles");
while ($file = readdir ($dir)) {
if (ereg (".gif$", "$file")){
$file2=str_replace(".gif","",$file);
$msg=str_replace(":$file2",'<img src="../pic/smiles/'.$file.'" alt="">',$msg);
}}
closedir ($dir);
return $msg; }
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_msg` WHERE `id_topic` = '$id'"), 0);
if($count > 0){
$pages = ceil($count/10);
if(isset($_GET['page'])){
$page = abs(intval($_GET['page']));
}else{
$page = 1;
}
$from = ($page-1)*10;
function AddBB($var) {
$search = array(
'/[b](.*?)[/b]/is',
'/[i](.*?)[/i]/is',
'/[adm](.*?)[/adm]/is',
'/[u](.*?)[/u]/is',
'/[url](.*?)[/url]/is',
'/[url=(.*?)](.*?)[/url]/is'
);
$replace = array(
'<strong>$1</strong>',
'<em>$1</em>',
'<font color="red">$1</font>',
'<u>$1</u>',
'<a href="$1">$1</a>',
'<a href="$1">$2</a>'
);
$var = preg_replace ($search, $replace, $var);
return $var;
}
$result = mysql_query("SELECT * FROM `forum_msg` WHERE `id_topic` = '$id' ORDER BY `time` LIMIT $from, 10");
while($msg = mysql_fetch_assoc($result)){
if(!isset($num)) $num = 1;
$num++;
////////////////////////////
$laikas = 3600;
$dabar = time();
$timeout = $dabar - $laikas;
$asd = mysql_num_rows(mysql_query("SELECT laikas, usr FROM online WHERE laikas > '$timeout' AND usr='$msg[login]'"));
echo '<div class="fon bg"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
if($asd == 0){
$status = "<img src='/pic/ico/off.jpg' alt=''/>"; }
else
{
$status = "<font color='lime'>On-line</font>"; }
echo $status;
$nickas = strip_tags($msg[login]);
$nickas = strip_tags($msg[login]);
$req = mysql_query("SELECT `storona`,`prava` FROM `users` WHERE `usr` = '$nickas'");
$pic = mysql_fetch_array($req);
echo' <img src="/pic/main/'.$pic['storona'].'.png" alt="#"/>';
echo ' <a href="../search.php?nick='.$msg['login'].'&go=go">'.$msg['login'].'</a>'; if($pic['prava']==5){
echo'<font color="lime">.GM</font>';} if($pic['prava']==2){
echo'<font color="gold">.M</font>';
}echo '</b><sup><small><font color="#999999"> '.date('d.m.Y / H:i', $msg['time']).'</small></sup></font><font color="#999999">';
$msg['text']=htmlspecialchars(addslashes($msg['text']));
echo '<br/>'.smiles(AddBB(htmlspecialchars(addslashes($msg['text'])))).'</font><br/>';
echo ' <a class="buuut" href="posting.php?act=answer&id='.$msg['id'].'&page='.$pages.'">ответ</a>';
if($msg['login'] == $user_id or $udata['prava'] > 1){
if($msg['time']+900 > time() or $udata['prava'] > 1){
echo ' <a class="buuut" href="posting.php?act=msg_edit&id='.$msg['id'].'">ред</a>';
}
}
if(!empty($msg['edit_login']) && !empty($msg['edit_time'])){
echo '<br>';
echo '<i><font color="#999999">Последнее. редактирование темы: '.date('d.m.y / H:i', $msg['edit_time']).', Кем: Администрацией</font></i>';
}
echo '</div></div></div></div></div></div></div></div></div>';
}
}
echo '<div class="fon bg"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo 'Добавить сообщение:<br/>';
echo '<form action="topic.php?id='.$id.'&page='.$pages.'" method="post" name="form">';
echo '<textarea name="text" rows="3"></textarea><br/>';
echo '<input class="buuut" name="submit" type="submit" value="Добавить" /></form></hr>';
echo '</div></div></div></div></div></div></div></div></div>';
include('down.php');
include('meny.php');
echo '<br/>';
navig($page, 'topic.php?id='.$id.'&', $pages);
if($topic['closed'] == 0){
echo 'Добавить сообщение:<br/>';
echo '<form action="posting.php?act=msg_add&id='.$topic['id'].'&page='.$page.'" method="post" name="form">';
echo '<textarea name="text" rows="3"></textarea><br/>';
echo '<input name="submit" type="submit" value="Добавить" /></form></hr>';
}else{
echo '<hr><font color="#999999"><i>Вы не можете добавить сообщение, этот топик закрыт!</hr></i></font><br/>';
}
}else{
echo'Выбранной темы не существует!';
}
echo"<hr><img src='../pic/main/chats.gif' alt='*'/> <a href="index.php">Форум</a><br/>";
echo"<img src='../pic/main/smils.gif' alt='*'/> <a href="../smile.php?">Смайлы</a>";
include('down.php');
include('meny.php');
?>