<?
include '../config.php';
include '../func.php';
head();
aut();
ban();
////////////////////////
####################Запись онлайна##################
mysql_query("UPDATE `profile` SET `online` = 'clan' WHERE `id` = '".$id_session."'");
####################################################

echo head. "<b>Группы</b>" . div;   
echo "<div class='link2'><b><a href=\"add.php\">Создать группу</a></b></div>";
$all = mysql_result(mysql_query("SELECT count(*) FROM `clans`"), 0);
if($all){
$onpage = 5;
$allpage = ceil($all/$onpage);
$this_page = (isset($_GET['p'])) ? intval($_GET['p']) : 1 ;
if($this_page < 1 || $this_page > $allpage)$this_page = 1;
$start = $this_page*$onpage - $onpage;

$result = mysql_query("SELECT * FROM clans order by id desc limit ".num($start).",".num($onpage)."");
while($a = mysql_fetch_assoc($result)){
    
    if ( $a['private'] == 0) 
    $status = 'Открытая';
    else
    $status = 'Закрытая';

if (!empty($a['url_file'])) {
    echo link2 . '<img src="../resize.php?img=clan/logo/'.$a['url_file'].'&width=80&height" alt="."/>';
} else {
    echo link2 . '<img src="../resize.php?img=noava.png&width=80&height" alt="."/>';
}


echo "<br/><b><a href=\"view.php?id=".$a['id']."\">".$a['name']."</a></b> | ".$status."<br/ >";
echo "".$a['info']."<br/>";

$all2 = mysql_result(mysql_query("SELECT count(*) FROM `clans_user` WHERE `clan` = '".$a['id']."'"), 0);
echo 'Людей в группе: '.$all2.'</div>';
}

echo link1 . '<b>Страницы:</b> ';
navigation($allpage,"index.php?p={p}",1,1);
echo div;
}

echo "<div class='link2'><b><a href=\"add.php\">Создать группу</a></b>";

echo div;

////////////////////////

pod_navig();
foot();
?>