<?php

include('includes/hlava.php');
title('Klub priateľov fotografie', '');

if ($link) {
  if ($db_selected) {
  
include('includes/vedla.php');
odkaz('');
include('includes/menu.php');
menu('','');
?>       
        
        <div class="obsah">  

          
<?php
      if ($_SESSION['aid'] != '') echo '<h2>moje <em>komentáre</em></h2>';
      else echo '<h2><em>treba</em> sa <em>prihlásiť</em></h2>';
  		$sql = "SELECT H.*, P.foto, P.id, P.nazov, A.meno, A.priezvisko, A.aid, UNIX_TIMESTAMP(H.cas) AS 'dat'
              FROM kpf_hodnot H, kpf_photos P, kpf_author A
              WHERE H.id=P.id AND H.aid='". $_SESSION['aid'] ."' AND P.aid=A.aid
              ORDER BY cas DESC;"; 

	     $result = mysql_query($sql, $link);
	     if ($result) {
        while ($row = mysql_fetch_assoc($result)) {
          echo '<p class="hodnot">';
          echo "<img src='photos/small/".$row['foto']."' alt='".$row['nazov']."' title='".$row['nazov']."' class='fot' />";
          if ($row['body']!='0') {
          echo '<b class="b'.$row['body'].'">'.$row['body'].'</b>'; }
          else {                  
          echo '';}
          echo '<a class="nazov_fotka" href="photo.php?id='.$row['id'].'">'.$row['nazov'].'</a><br/>  
                <a class="autor_fotka" href="author.php?id='.$row['aid'].'">'.$row['meno'].' '.$row['priezvisko'].'</a>';
          //echo '<a class="nazov_fotka" href="photo.php?id='.$row['id'].'">'.$row['nazov'].'</a> -  
                //<a class="autor_fotka" href="author.php?id='.$row['aid'].'">'.$row['meno'].' <em>'.$row['priezvisko'].'</em></a><br />';
          echo ' <span class="date">'.date("d.m.Y H:i:s", $row['dat']).'</span><br />';
          echo '<span class="text">'.$row['text'].'</span>';
          echo '</p>';
        }
      }
      else echo 'b';
        // end vyber db
     	mysql_close($link);
    } // end spojenie s db
  } else {
  //neboli zadane vsetky potrebne udaje
  echo "<p style='color: #FF0000;'>Nebolo odoslané ID fotografie, ktorú treba zobraziť.</p>";
}
include('includes/pata.php');
  ?>
