View file autoload/icon.php

File size: 1.3Kb
<?php

function icon($user_id)
{
    global $user, $settings;

    # Проверяем существование юзера
    if (mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `id` = '". num($user_id) ."' LIMIT 1"), 0) == 0) $icon = '<img src="'. URL .'/design/icons/user_guest.png" alt="Гость" />';
    else
    {
        $user2 = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '". num($user_id) ."' LIMIT 1"));

        if ($user2['pol'] == 0) $icon = (isset($user) && $settings['img_site'] == 2?'[?]':'<img src="'. URL .'/design/icons/user_question.png" alt="?" />');
        //else if ($user2['pol'] == 1 && $user2['level'] > 14) $icon = '<img src="'. URL .'/design/icons/user_administrator_fm.png" alt="Администратор" />';
        //else if ($user2['pol'] == 2 && $user2['level'] > 14) $icon = '<img src="'. URL .'/design/icons/user_administrator_m.png" alt="Администратор" />';
        else if ($user2['pol'] == 1) $icon = (isset($user) && $settings['img_site'] == 2?'[ж]':'<img src="'. URL .'/design/icons/user_female.png" alt="ж" />');
        else if ($user2['pol'] == 2) $icon = (isset($user) && $settings['img_site'] == 2?'[м]':'<img src="'. URL .'/design/icons/user_male.png" alt="м" />');
    }

    return $icon;
}

?>