Просмотр файла who.php

Размер файла: 1.63Kb
<?php
include 'sys/db.php';
include 'sys/conf.php';
include 'sys/start.php';
include 'sys/functions.php';
$config_title_name = "Кто в комнате";
include 'style/head.php';
if(isset($user['login'])){
echo "<div class=title>Кто в комнате?</div>\n";
echo "<div class=content>\n";
$id = intval($_GET['id']);
if ($id != '0') {
function pages($start, $total, $page, $onpage){
if ($start != 0) echo '<a href="'.$page.'?start='.($start - $onpage).'&id='.$_GET['id'].'">&lt;-Назад</a> ';
else echo '&lt;-Назад';
echo ' | ';
if ($total > $start + $onpage)
echo ' <a href="'.$page.'?start='.($start + $onpage).'&id='.$_GET['id'].'">Далее-&gt;</a>';
else echo 'Далее-&gt;';}
$total = mysql_result(mysql_query("SELECT COUNT(*)FROM `chat_who` WHERE `room` = '$id' "),0);
$start = isset($_GET['start']) ? abs((int)$_GET['start']) : 0;
if($start > $total) $start = 0;
if ($total < $start + 10) $end = $total;
else $end = $start + 10;
$nameroom = mysql_query("SELECT name FROM `room` WHERE `id` = '$id'");
if($room = mysql_fetch_array($nameroom)){
echo "<b>".$room[name]."</b>:<br>";}
$who = mysql_query("SELECT id_user FROM `chat_who` WHERE `room` = '$id'");
while($whochat = mysql_fetch_array($who)){
$userwho = mysql_query("SELECT * FROM `users` WHERE `id` = '$whochat[id_user]'");
if($userswho = mysql_fetch_array($userwho)){
echo "<a href='anketa.php?id=".$userswho[id]."'>".$userswho[login]."</a>, ";}}
}else{ echo " ID комнаты пустое!<br>\n";}
echo "</div>\n";
echo "<div class=stat>\n";
echo "<a href='index.php'>Прихожая</a>\n";
echo "</div>\n";
}else{ header ("Location: index.php"); exit;}
include 'style/foot.php';
?>