<?
    $GLOBALS
['highlight'] = 'friends';
    
    require_once(
'include/functions/pages.php');
    
    
$_page = isset($_GET['p']) ? intval($_GET['p']) : 1;

    include(
'include/parts/header.php');
    
    
$entries mysql_fetch_array(mysql_query("SELECT COUNT(*) AS num FROM friends"));
    
$page_count ceil($entries['num'] / 100);
    
$pages '<span class="pages">Page: ' pages('?s=friends'$_page$page_count) . '</span>';
?>

<div class="header">Friends</div>
<div class="content" style="padding: 0px 5px 5px 5px;">
<?
    $friends 
mysql_query("SELECT friend_id FROM friends WHERE user_id = '" $GLOBALS['auth']['id'] . "' ORDER BY friend_id LIMIT " . (($_page 1) * 100) . ', ' 100);
    if (
mysql_num_rows($friends) > 0)
    {
        echo 
'<table width="100%" cellpaddin="0" cellspacing="0" border="0"><tr><td>';
        while (
$friends_row mysql_fetch_array($friends))
        {
            echo 
box_image_top();
            echo 
'<table width="' . (THUMB_WIDTH 1.3) . '" height="' . (THUMB_HEIGHT 1.3) . '" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" valign="top">';
            echo 
'<a href="?s=profile&u=' get_username($friends_row['friend_id']) . '"><img src="?g=thumb&i=' get_main_image_id($friends_row['friend_id']) . '" width="' . (THUMB_WIDTH 1.3) . '" height="' . (THUMB_HEIGHT 1.3) . '" alt="" style="border: 0px;"></a><br />'
            echo 
'<div style="padding: 5px 0px 0px 0px;"></div>';
            echo 
get_username($friends_row['friend_id']) . '<br />';
            echo 
'</td></tr></table>';
            echo 
box_image_bottom();
        }
        echo 
'</td></tr></table>';
    }
    else
    {
        echo 
'<div style="padding: 5px 0px 0px 0px;"></div>You don\'t have any friends...';
    }    
?>
</div>

<?
    
include('include/parts/footer.php');
?>