<?php
session_start();
ob_start();
include_once "inc/db_connect.php";
include_once "inc/fnc.php";
header('Content-Type: text/html;charset=utf8');
$err = "";
if(isset($_POST['regok'])){unset($_SESSION['reg_ok']);}
if(!isset($_SESSION['user'])){
	header("Location: index.php?");
	
bann($user);

$num = 10;
@$page = $_GET['page'];
$result00 = mysql_query("SELECT COUNT(*) FROM userlist WHERE online='1'");
$temp = mysql_fetch_array($result00);
$posts = $temp[0];
$total = (($posts - 1) / $num) + 1;
$total =  intval($total);
$page = intval($page);
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;


$r = mysql_query ("select * from userlist where online='1' order by id desc limit $start, $num",$db);
$r2 = mysql_query ("select * from userlist where online='1'");
if (mysql_num_rows($r2) > 0)
{
$myrow2 = mysql_fetch_array($r);
include ("head.php");
sms($user,$pass);
$on = "0";
do {
$on = $on + 1;
$m = "Мужской";
echo "<a href='info.php?id=".$myrow2['id']."'>".$myrow2['user']."</a>";
}
while ($myrow2 = mysql_fetch_array($r));


if ($page != 1) echo "<a href=online.php?user=$user&pass=$pass&page=".($page - 1).">Назад</a>";
if ($page != $total) echo " <a href=online.php?user=$user&pass=$pass&page=".($page + 1).">Далее</a>";

}
else
{
include ("head.php");
echo "<div class='nav'>";
echo "Нет некого в онлайн!<br />";
echo "</div>";
echo "<a href=menu.php?user=$user&pass=$pass>В меню</a>";
include ("foot.php");
exit();
}




echo "<a href=menu.php?user=$user&pass=$pass>В меню</a>";
include ("foot.php");
exit();
}
else
{
include ("head.php");
echo "<div class='mono'>";
echo "Ошибка! <br />Неверный <b>Ник</b> или <b>Пароль</b>!<br />";
echo "</div>";
echo <<<sss
<a href="index.php">На главную</a>
sss;
include ("foot.php");
}

?>