View file users.php

File size: 1.53Kb
<?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";
function pages($start, $total, $page, $onpage){
if ($start != 0) echo '<a href="'.$page.'?start='.($start - $onpage).'">&lt;-Назад</a> ';
else echo '&lt;-Назад';
echo ' | ';
if ($total > $start + $onpage)
echo ' <a href="'.$page.'?start='.($start + $onpage).'">Далее-&gt;</a>';
else echo 'Далее-&gt;';}
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `users`"),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;
$result = mysql_query("SELECT * FROM `users` ORDER BY `posts` DESC  LIMIT $start, 10");
while($users = mysql_fetch_array($result)){
echo "<div class=box>";
if ($users['gender']==1)echo "<img src='img/man.gif' alt=''> ";
elseif ($users['gender']==2)echo "<img src='img/woman.gif' alt=''> ";
elseif ($users['gender']==3)echo "<img src='img/bot.gif' alt=''> ";
echo "<a href='anketa.php?id=".$users['id']."'><b>".$users['login']."</b></a> [".$users['posts']."] </div>\n";}
echo "</div>\n";
echo "<div class=stat>\n";
pages($start, $total, 'users.php', 10);
echo "</div>\n";
echo "<div class=stat><a href='index.php'>Прихожая</a></div>\n";
}else{ header ("Location: index.php"); exit;}
include 'style/foot.php';
?>