<?
$q = query("SELECT `gallery_foto`.`id`, `gallery_foto`.`id_user`, `gallery_foto`.`id_gallery`, `user`.`nick` FROM `gallery_foto` INNER JOIN `user` ON `gallery_foto`.`id_user` = `user`.`id` AND `user`.`id` != '" . (isset($_SESSION['id_user']) ? $_SESSION['id_user'] : 0) . "' WHERE `user`.`date_last` > " . (time() - $set['time_online']) . " AND `gallery_foto`.`avatar` = '1' ORDER BY `user`.`date_last` DESC LIMIT 10");

while ($foto = mysql_fetch_assoc($q)) {
	?>
	<a id="i-photo-<?= $foto['id']?>" href="/foto/<?= $foto['id_user']?>/<?= $foto['id_gallery']?>/<?= $foto['id']?>/" title="<?= $foto['nick']?>"><img class="avatar" src="/foto/foto50/<?= $foto['id']?>.jpg" alt="Photo Screen" /></a> 
	<?
}
exit;