View file online.php

File size: 1.51Kb
<?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>\nКто в чате?\n</div>\n";
echo "<div class=content>\n";
function pgs($start, $total, $page, $onpage){
if ($start != 0) echo '<a href="'.$page.'?start='.($start - $onpage).'">Назад</a> ';
else echo 'Назад';
echo ' | ';
if ($total > $start + $onpage)
echo ' <a href="'.$page.'?start='.($start + $onpage).'">Далее</a>';
else echo 'Далее';}
$timeo = time()-600;
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `time` > '$timeo' ORDER BY `time`"),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;
$onlin = mysql_query("SELECT * FROM `users` WHERE `time` > '$timeo' ORDER BY `time` DESC LIMIT $start, $end");
while($use = mysql_fetch_array($onlin)){
$n++;
echo "<div class=box>";
if ($use['gender']==1)echo "<img src='img/man.gif' alt=''> ";
elseif ($use['gender']==2)echo "<img src='img/woman.gif' alt=''> ";
echo "<a href='anketa.php?id=".$use['id']."'>".$use['login']."</a></div>\n";}
echo "</div>\n";
echo "<div class=stat>\n";
pgs($start, $total, 'online.php', 10);
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';
?>