<?php
  include("./inc/func.php");
  
  $cas=time();
  
  db_update("uloziste", "PRIKAZ=\"disky\", 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=\"disky\") ) 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;}
                  
      -->
    </style>
    <script language="JavaScript">
      
      parent.document.getElementById('nahrat').style.visibility='hidden';
    
    </script>
</head>
<body>
  <div style="font-weight: bold; font-size: 13px; background-color: #ccd9f4;">disk</div>
  
  <?php
    if(!$chyba)
    {
       $result=explode("|",$result);
       for($i=0;$i<count($result);$i++)
       {
          ?>
          <div <?php if( ((!@$_GET['disk']) and ($i==0))or(@$_GET['disk']==$result[$i]) ){ ?>style="background-color: #d9e0f2;"<?php ;}; ?>><a href="?cas=<?php echo time(); ?>&disk=<?php echo $result[$i]; ?>" title="<?php echo $result[$i]; ?>"><?php echo $result[$i]; ?>:\</a></div>
          <?php
          if( ((!@$_GET['disk']) and ($i==0))or(@$_GET['disk']==$result[$i]) )
          {
          ?>
            <script language="JavaScript">
              var d = new Date();
              parent.document.getElementById('adresare').src='user_dir_adresare.php?cas='+d.getTime()+'&adresar=<?php echo $result[$i]; ?>:\\.';
            </script>
          <?php
          };
          ?>
          <?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>
