Файл: chat/room.php
Строк: 53
<?php
define('ROOT','../');
define('GCMS',true);
require_once (ROOT.'system/power.php');
$func->aut();
if ($id) {
$type = $db -> query("SELECT * FROM `chat` WHERE `id` = '".$id."'");
if ($type -> num_rows > 0) $the = $type -> fetch_assoc(); else $the = false;
} else $the = false;
if($the != false){
$diz -> head('Комната '.$the['name'].'');
$diz -> title("$the[topik]");
$count = $db -> dbcount('COUNT(`id`)','chat_post',"`room` = '".$id."'");
$num = isset($ya['num']) ? $ya['num'] : 10;
$total = intval(($count - 1) / $num) + 1;
if (!isset($_GET['page']) || !is_numeric($_GET['page']) || $_GET['page'] < 1 )
{
$page = 1;
} elseif($_GET['page'] > $total)
{ $page = $total;
} else $page = (int)$_GET['page'];
$start = $page * $num - $num;
echo '<div class="levo"><a href="newpost.php?id='.$id.'&page='.$page.'" class="levo_tuch">Сказать</a></div>';
if($nastr['smiles']=='on')echo '<div class="levo"><a href="'.ROOT.'help/smile.php" class="levo_tuch">Смайлы</a></div>';
header('refresh: 15; url=room.php?id='.$id.'');
$for = $db -> query("SELECT * FROM `chat_post` WHERE `room` = '".(int)$id."' ORDER BY `time` DESC LIMIT ".$start.",".$num);
if($count==0)echo '<div class="fon">Сообщений пока нет</div>';
while ($assoc = $for -> fetch_assoc()) {
$otv = null;
if ($ya['level'] >= 3)$del = '<a href="delpost.php?id='.$assoc['id'].'">[Удалить]</a>';
if ($ya['id']!=$assoc['yaid']) {
$otv = '<a href="newpost.php?id='.$id.'&sid='.$assoc['yaid'].'&page='.$page.'">'.$func->famname($assoc['yaid'],0).'</a>';
}else $otv = $func->famname($assoc['yaid'],0);
$assoc['text'] = preg_replace('#(.*?)'.$func->famname($ya['id'],0).'(.*?)#si', '1<b>'.$func->famname($ya['id'],0).'</b>2', $assoc['text']);
echo '<div class="fon"> '.$otv.' <span class="date">'.$func -> times(date('H:i:s',$assoc['time'])).'</span> '.$del.'<br/>
'.$func -> smiles($assoc['text']).'</div>';
}
echo '<div class="fon"><form action="newpost.php?id='.$id.'&page='.$page.'" method="post" enctype="multipart/form-data">
<hr><textarea name="text" rows="'.$ya['height'].'" cols="'.$ya['width'].'"></textarea><br/>
<input type="submit" value="Сказать"/></form></div>';
$act = 'room.php?id='.$id;
echo $func -> pagenav($act,$page,$total);
}else header('location: index.php');
echo '<div class="levo"><a href="./" class="levo_tuch">'.$diz -> img('back.png').' Назад</a></div>';
echo '<div class="levo"><a href="../" class="levo_tuch">'.$diz -> img('home.png').' На главную</a></div>';
#####Копирайт#######
$diz -> out($msg);
?>