<?


function aut()
{
global $set;





if ($set['web']==false)
{

global $user;
if (isset($user))
{


echo "<div class='panel'>";
if ($_SERVER['PHP_SELF']!='/index.php'){
echo '<a href="/index.php"><img src="/icons/hm.png" height="24" width="24" alt="" /></a>'; 
}
echo '<a href="/id'.$user[id].'"><img src="/icons/id.png" height="24" width="24" alt="" /></a>';
echo '<a href="/umenu.php"><img src="/icons/lk.png" height="24" width="24" alt="" /></a>'; 
$k_new=mysql_result(mysql_query("SELECT COUNT(`mail`.`id`) FROM `mail`
 LEFT JOIN `users_konts` ON `mail`.`id_user` = `users_konts`.`id_kont` AND `users_konts`.`id_user` = '$user[id]'
 WHERE `mail`.`id_kont` = '$user[id]' AND (`users_konts`.`type` IS NULL OR `users_konts`.`type` = 'common' OR `users_konts`.`type` = 'favorite') AND `mail`.`read` = '0'"),0);
$k_new_fav=mysql_result(mysql_query("SELECT COUNT(`mail`.`id`) FROM `mail`
 LEFT JOIN `users_konts` ON `mail`.`id_user` = `users_konts`.`id_kont` AND `users_konts`.`id_user` = '$user[id]'
 WHERE `mail`.`id_kont` = '$user[id]' AND (`users_konts`.`type` = 'favorite') AND `mail`.`read` = '0'"),0);


if ($k_new!=0 && $k_new_fav==0) {
echo "<a href='/new_mess.php'><img src='/icons/messaga.png' height='24' width='24' alt='' /> <b>$k_new</b></a>\n";
}else{
 echo '<a href="/konts.php"><img src="/icons/mess.png" height="24" width="24" alt="" /></a>'; 
}


$lenta = mysql_result(mysql_query("SELECT COUNT(*) FROM `lenta` WHERE `id_kont` = '$user[id]' AND `read` = '0' "),0);
if($lenta>0) echo "<a href='/lenta.php'><img src='/icons/lenta.png' height='24' width='24' alt='' /> <b>+$lenta</b></a>";

if ($k_new_fav!=0)
echo "<b><a href='/new_mess.php'><img src='/style/icons/mess_fav.png' alt='$k_new_fav' /> Сообщени".($k_new_fav==1?'е':'я')."</a></b><br />\n";


$zoz = mysql_result(mysql_query("SELECT COUNT(*) FROM `frends_new` WHERE `to` = '$user[id]'"), 0);
 if (mysql_result(mysql_query("SELECT COUNT(*) FROM `frends_new` WHERE `to` = '$user[id]' LIMIT 1"), 0) > 0)
{
 echo ' <a href="/frend_new.php"><img src="/icons/frda.png" height="24" width="24" alt="" /> <b>+'.$zoz.'</b></a>';
}
else {

}


$k_n_s_zak=mysql_result(mysql_query("SELECT COUNT(`forum_zakl`.`id_them`) FROM `forum_zakl` LEFT JOIN `forum_p` ON `forum_zakl`.`id_them` = `forum_p`.`id_them` AND `forum_p`.`time` > `forum_zakl`.`time` WHERE `forum_zakl`.`id_user` = '$user[id]' AND `forum_p`.`id` IS NOT NULL"),0);
if ($k_n_s_zak>0)
echo "<a href='/zakl.php' title='Новые сообщения в закладках'>Сообщения в закладках ($k_n_s_zak)</a><br />\n";



if ($_SERVER['PHP_SELF']!='/index.php'){
}else{
 echo '<a href="/end.php"><img src="/icons/end.png" height="24" width="24" alt="" /></a>'; 
}

echo '</div>';
$money=mysql_result(mysql_query("SELECT COUNT(*) FROM `udacha_yes` WHERE `user`='$user[id]'"),0);
if($money>0){echo '<div class="div"><img src="/style/icons/1016.gif" alt="" /> <a href="/object/udacha.php">Вам улыбнулась удача!</a></div>';
}
}
}

}



?>