<?php
if (isset($user)){
$res = mysql_query("SELECT * FROM `blog_list` ORDER BY id DESC LIMIT 1");
while ($blog = mysql_fetch_array($res)){

echo "<div class='penanda'>Blog friends</div></div>";
$ank=get_user($blog['id_user']);
echo "<table class='post'><tr>\n";
echo "  <td>\n";
echo "Author : <a href='/blog/user.php?id=$ank[id]'>$ank[nick]</a> <br/>Post : ".vremja($blog['time'])."<br/>\n";
echo esc(trim(br(bbcode(links(stripcslashes(htmlspecialchars(substr($blog['msg'], 0, 80))))))))."<a href='/blog/list.php?id=".$blog['id']."'> Read more</a>";

$anu = mysql_result(mysql_query("SELECT COUNT(*) FROM `blog_like` WHERE `id_blog` = '$blog[id]'"),0);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `blog_like` WHERE `id_blog` = '$blog[id]' AND `id_user` = '$user[id]' LIMIT 1"),0)==0){

echo " &#183; <a href='/blog/like.php?id=".$blog['id']."'>Suka</a>";} else {
echo " &#183; <img src='status/suka.gif' width='10' height='10'>$anu <a href='/blog/like.php?id=".$blog['id']."'>Suka</a> ";
}
$cmn=mysql_result(mysql_query("SELECT COUNT(*) FROM `blog_komm` WHERE `id_blog` = '$blog[id]'"),0);
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `blog_komm` WHERE `id_blog` = '$blog[id]'"),0)==0){
echo " &#183; <a href='/blog/list.php?id=".$blog['id']."'> komentar</a>\n";
}
else
{
echo " &#183; <a href='/blog/list.php?id=".$blog['id']."'>$cmn komentar</a>\n";
}
}
echo "  </td>\n";
echo "   </tr>\n";
echo "   <tr>\n";

echo "</td>\n";
echo "</tr></table>\n";
}

?>
