<?php
if(@$_GET['adresar'])
{

  include("./inc/func.php");
  
  $cas=time();
  
  db_update("uloziste", "PRIKAZ=\"soubory ". trim($_GET['adresar']) ."\", ODPOVED=\"\", DATUM=". $cas, "ID=". $_SESSION['UZIVATEL_ID']);
  
  $result="";
  $i=0;
  $chyba=false;
  
  while(!$result)
  {
     if($i>=9){$chyba=true; break;};
     
     $result=db_vypis1("ODPOVED", "historie where ( (UID=". $_SESSION['UZIVATEL_ID'] .") and (DATUM>=$cas) and (PRIKAZ=\"soubory ". trim($_GET['adresar']) ."\") ) order by DATUM desc");
     sleep(1);
     $i++;
  };  
  
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
    <style>
      <!--    
      
      body  {margin: 0px 0px 0px 0px; font-family: Arial; background-color: #f0f0f6; font-size: 12px; text-align: center;}
      
      a {color: #080; text-decoration: none;}
      a:hover {text-decoration: underline; font-weight: bold;}
      
      span {cursor: pointer;}
                  
      -->
    </style>
    <script language="JavaScript">
    
      function nabidka(viditelne,ident)
      {
         parent.document.getElementById('nabidka').style.visibility= viditelne?'visible':'hidden';
         ident.style.fontWeight='bold';
      };
    
    </script>
</head>
<body>
  <div style="font-weight: bold; font-size: 13px; background-color: #ccd9f4;">soubory</div>
  
  <?php
    if(!$chyba)
    {
    ?>
    <?php
      $result=explode("|",$result);

       for($i=0;$i<count($result);$i++)
       {
          ?>
          <div align="left" style="padding-left: 5px; padding-right: 5px;"><span onclick="javascript:nabidka(1,this);parent.document.soubor='<?php echo entita($result[$i]); ?>';" onmouseover="this.style.fontWeight='bold';" onmouseout="this.style.fontWeight='normal';"><?php echo $result[$i]; ?></span></div>
          <?php
       };
    }else{
    ?>
      <div align="center" style="color: #f00;">Vypršel čas pro odpověď<br>
      <a href="javascript:document.location.reload();">obnovit</a></div>
    <?php
    };
  ?>
</body>
</html>
<?php
;};
?>
