<?php
function openuser(){
echo '<table cellpadding="25" background="'.BASEDIR.THEME.'login-img/login-bg1.png" style="padding-left:20px;"cellspacing="0" width="319" height="152"><tr><td>';
}

function closeuser(){
echo '</td></tr></table><br>';
}

if (iMEMBER) {

echo '<table cellpadding="0" cellspacing="0" width="250" height="150">';
echo '<tr><td  valign="top" align="center">';
	$msg_count = dbcount("(message_id)", DB_MESSAGES, "message_to='".$userdata['user_id']."' AND message_read='0'AND message_folder='0'");
	openuser($userdata['user_name']);
if ($userdata['user_avatar'] != ""){
echo "<img width='80' height='80' border='0' src='".($userdata['user_avatar'] != "" ? BASEDIR."images/avatars/".$userdata['user_avatar'] : THEME."/login-img/noawatar.png")."'>";
	}else{
echo "<img width='80' height='80' border='0' src='".THEME."/login-img/noawatar.png'>";
}
echo "</td>";

echo '<td align="center"><b style="color:green;">'.$userdata["user_name"].'</b><br><a href="'.BASEDIR.'edit_profile.php" class="p"><img src="'.BASEDIR.THEME.'/login-img/profil.png"></a>';

echo '&nbsp;<a href="'.BASEDIR.'members.php" class="p"><img src="'.BASEDIR.THEME.'/login-img/ludia.png"></a>';

if ($msg_count > "0") { 
echo "<a href='".BASEDIR."messages.php' class='p'><img src='".BASEDIR.THEME."/login-img/m2.png'></a>\n"; 
}else{
echo "&nbsp;<a href='".BASEDIR."messages.php' class='p'><img src='".BASEDIR.THEME."/login-img/m1.png'></a>\n";
}

if (iADMIN && (iUSER_RIGHTS != "" || iUSER_RIGHTS != "C")) {
echo '&nbsp;&nbsp;<a href="'.ADMIN.'index.php'.$aidlink.'" class="p"><img src="'.BASEDIR.THEME.'/login-img/admin2.png"></a>';
}else{
echo '&nbsp;<img class="p" src="'.BASEDIR.THEME.'/login-img/admin.png">';
}
echo '&nbsp;<a href="'.BASEDIR.'setuser.php?logout=yes" class="p"><img src="'.BASEDIR.THEME.'/login-img/logout.png"></a>';

echo '</td>';
echo '</tr></table>';

echo '</td></tr></table>';
        closeuser();
} else {
	openuser("Prihlásenie");
        echo '<center><table cellpadding="0" cellspacing="0" align="center">';
	echo "<form name='loginform' method='post' action='".FUSION_SELF."'>\n";
	echo "<tr><td>".$locale['global_101'].":</td><td><input type='text' name='user_name' class='textbox' style='width:150px' /><br />\n</td>";
	echo "<tr><td>".$locale['global_102'].":</td><td> <input type='password' name='user_pass' class='textbox' style='width:150px' /><br />\n</td></tr>";
	echo "</table><input type='checkbox' name='remember_me' value='y' title='".$locale['global_103']."' style='vertical-align:middle;' />\n";
	echo "<input type='submit' name='login' value='".$locale['global_104']."' class='button' /></form>";
echo '<br><b><a href="http://mancraft.eu/register.php">Zaregistrovať sa</a> - <a href="http://mancraft.eu/lostpassword.php">Strata hesla?</a><br></b>';
	echo "</center>";
        closeuser();
}
?>