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


echo head . "ТОП" . div;

switch ( $_GET['mod'] ) {
    
    default:

    echo link1 . '<b>Самые общительные:</b>' . div;
    
    $result = mysql_query ("SELECT * FROM `profile` ORDER BY `postov` DESC LIMIT 1");
    while ($a = mysql_fetch_array($result)) {
        $chat = $a['id'];
        $postov = $a['postov'];
    }
        
    echo link2 .'В чате: #1 <b>'.user($chat).'</b> ['.$postov.' постов]<br/ >';
    echo 'Смотреть: <a href="top.php?mod=chat">ТОП-10</a>' . div;
    
    $result = mysql_query ("SELECT * FROM `profile` ORDER BY `postov_forum` DESC LIMIT 1");
    while ($a = mysql_fetch_array($result)) {
        $forum = $a['id'];
        $postov = $a['postov_forum'];
    }
    echo link2 .'На форуме: #1 <b>'.user($forum).'</b> ['.$postov.' постов]<br/ >';
    echo 'Смотреть: <a href="top.php?mod=forum">ТОП-10</a>' . div;
    
    
    $result = mysql_query ("SELECT * FROM `profile` ORDER BY `many` DESC LIMIT 1");
    while ($a = mysql_fetch_array($result)) {
        $bogat = $a['id'];
        $many = $a['many'];
    }
    echo link2 .'Самый богатый: #1 <b>'.user($bogat).'</b> ['.$many.' монет]<br/ >';
    echo 'Смотреть: <a href="top.php?mod=many">ТОП-10</a>' . div;
    
    $result = mysql_query ("SELECT * FROM `profile` ORDER BY `iq` DESC LIMIT 1");
    while ($a = mysql_fetch_array($result)) {
        $id = $a['id'];
        $iq = $a['iq'];
    }
    echo link2 .'Самый умный: #1 <b>'.user($id).'</b> [IQ: '.$iq.']<br/ >';
    echo 'Смотреть: <a href="top.php?mod=iq">ТОП-10</a>' . div;
    
    
    $result = mysql_query ("SELECT * FROM `profile` ORDER BY `rating` DESC LIMIT 1");
    while ($a = mysql_fetch_array($result)) {
        $popular = $a['id'];
        $rayting = $a['rating'];
    }
    echo link2 .'Самый популярный: #1 <b>'.user($popular).'</b> [рейтинг '.$rayting.'%]<br/ >';
    echo 'Смотреть: <a href="top.php?mod=rayting">ТОП-10</a>' . div;
    
    $result = mysql_query ("SELECT * FROM `profile` ORDER BY `extra` DESC LIMIT 1");
    while ($a = mysql_fetch_array($result)) {
        $popular = $a['id'];
        $rayting = $a['extra'];
    }
    echo link2 .'Баллы: #1 <b>'.user($popular).'</b> ['.$rayting.' баллов]<br/ >';
    echo 'Смотреть: <a href="top.php?mod=extra">ТОП-10</a>' . div;
    break;
    



    case 'chat':
    $result = mysql_query ("SELECT * FROM `profile` ORDER BY `postov` DESC LIMIT 10");
    
    $i = 0;
    while ($a = mysql_fetch_array($result)) {
    
    $i++;
    if ( $i == 10) $i = 'Последний: ';
    $m=strtr($i, array( '1'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/konkurs.png" alt=""/>', '2'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/lafes_user.gif" alt=""/>', '3'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/gold.gif" alt=""/>', '4'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/silver.gif" alt=""/>', '5'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/bronze.gif" alt=""/>' ));
    
    
    echo link2 . '<b>'.$m.'</b> : '.user($a['id']).' ['.$a['postov'].' постов]</div>';
    }
    break; 
    
    
    
    case 'forum':
    $result = mysql_query ("SELECT * FROM `profile` ORDER BY `postov_forum` DESC LIMIT 10");
    
    $i = 0;
    while ($a = mysql_fetch_array($result)) {
    
    $i++;
    if ( $i == 10) $i = 'Последний: ';
    $m=strtr($i, array( '1'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/konkurs.png" alt=""/>', '2'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/lafes_user.gif" alt=""/>', '3'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/gold.gif" alt=""/>', '4'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/silver.gif" alt=""/>', '5'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/bronze.gif" alt=""/>' ));
    
    
    echo link2 . '<b>'.$m.'</b> : '.user($a['id']).' ['.$a['postov_forum'].' постов]</div>';
    }
    break; 
    
    case 'many':
    $result = mysql_query ("SELECT * FROM `profile` ORDER BY `many` DESC LIMIT 10");
    
    $i = 0;
    while ($a = mysql_fetch_array($result)) {
    
    $i++;
    if ( $i == 10) $i = 'Последний: ';
    $m=strtr($i, array( '1'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/konkurs.png" alt=""/>', '2'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/lafes_user.gif" alt=""/>', '3'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/gold.gif" alt=""/>', '4'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/silver.gif" alt=""/>', '5'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/bronze.gif" alt=""/>' ));
    
    
    echo link2 . '<b>'.$m.'</b> : '.user($a['id']).' ['.$a['many'].' монет]</div>';
    }
    break; 
    
    
    case 'rayting':
    $result = mysql_query ("SELECT * FROM `profile` DESC LIMIT 10");
    
    $i = 0;
    while ($a = mysql_fetch_array($result)) {
    
    $i++;
    if ( $i == 10) $i = 'Последний: ';
    $m=strtr($i, array( '1'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/konkurs.png" alt=""/>', '2'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/lafes_user.gif" alt=""/>', '3'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/gold.gif" alt=""/>', '4'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/silver.gif" alt=""/>', '5'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/bronze.gif" alt=""/>' ));
    
    
    echo link2 . '<b>'.$m.'</b> : '.user($a['id']).' [Рейтинг: '.$a['rating'].'%]</div>';
    }
    break; 
    
    
    case 'extra':
    $result = mysql_query ("SELECT * FROM `profile` WHERE `level` < 1 ORDER BY `extra` DESC LIMIT 10");
    
    $i = 0;
    while ($a = mysql_fetch_array($result)) {
    
    $i++;
    if ( $i == 10) $i = 'Последний: ';
    $m=strtr($i, array( '1'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/konkurs.png" alt=""/>', '2'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/lafes_user.gif" alt=""/>', '3'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/gold.gif" alt=""/>', '4'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/silver.gif" alt=""/>', '5'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/bronze.gif" alt=""/>' ));
    
    
    echo link2 . '<b>'.$m.'</b> : '.user($a['id']).' [Баллов: '.$a['extra'].']</div>';
    }
    break; 
    
    case 'iq':
    $result = mysql_query ("SELECT * FROM `profile` ORDER BY `iq` DESC LIMIT 10");
    
    $i = 0;
    while ($a = mysql_fetch_array($result)) {
    
    $i++;
    if ( $i == 10) $i = 'Последний: ';
    $m=strtr($i, array( '1'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/konkurs.png" alt=""/>', '2'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/lafes_user.gif" alt=""/>', '3'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/gold.gif" alt=""/>', '4'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/silver.gif" alt=""/>', '5'=>'<img src="http://'.$_SERVER['HTTP_HOST'].'/medali/bronze.gif" alt=""/>' ));
    
    
    echo link2 . '<b>'.$m.'</b> : '.user($a['id']).' [IQ: '.$a['iq'].']</div>';
    }
    break; 

    

}

echo div;


navig();
foot();
?>