<?
function user_nick($id,$link)
{
global $mysql,$color,$set;
$q = mysql_query("SELECT level,time,nickname FROM `$mysql[pref]users` WHERE `id` = '$id' LIMIT 1;");
$user = mysql_fetch_array($q);


if ($user['level']==1)$stat=" <span style=\"color:$color[level]\"></span>";
// mod
elseif ($user['level']==2)$stat=" <span style=\"color:$color[level]\"></span>";
// smd
elseif ($user['level']==3)$stat=" <span style=\"color:$color[level]\"></span>";
//adm
elseif ($user['level']==4)$stat=" <span style=\"color:$color[level]\"></span>";
else $stat='';


if ($user['time']>time()-$set['time_sess'])$on="<img src=\"".BASEDIR."SYSTEM/themes/default/img/user/on.png\" alt=\"\" />";
else $on="<img src=\"".BASEDIR."SYSTEM/themes/default/img/user/off.png\" alt=\"\" />";

if (!empty($link))echo "<a href=\"$link\">";

echo "<span style=\"color:$color[mess_nick]\"><b>$user[nickname]</b></span>";

if (!empty($link))echo "</a>";

echo "$stat $on";
}


function user_pic($id)
{
global $mysql,$color,$set,$web_browser,$user,$them;
$q = mysql_query("SELECT avatar,pol FROM `$mysql[pref]users` WHERE `id` = '$id' LIMIT 1;");
$user2 = mysql_fetch_array($q);
if (isset($user) && ($web_browser==0 && $user['show_avatar']==1 || $web_browser==1 && $user['show_avatar2']==1) && $user2['avatar']!='' && is_file("".BASEDIR."SYSTEM/images/avat/$user2[avatar]"))
echo "<img src=\"".BASEDIR."SYSTEM/images/avat/$user2[avatar]\" height=\"32\" width=\"32\" alt=\"Аватар\" />\n";
else
echo "<img src=\"".BASEDIR."SYSTEM/themes/$them/img/user/pol_$user2[pol].gif\" alt=\"\" />";
}


function user_data($id)
{
global $mysql;
$q = mysql_query("SELECT * FROM `$mysql[pref]users` WHERE `id` = '$id' LIMIT 1;");
return mysql_fetch_array($q);
}


?>
