<?php
  include("./inc/func.php");
  
  $cas=time();
  
  if(!db_vypis1("count(ID)","uloziste where ((ID=". $_SESSION['UZIVATEL_ID'] .") and (Not(PRIKAZ=\"\")) and (ODPOVED=\"\"))") )
  {
     @unlink("usr/". uzivatel('LOGIN') ."/plocha.jpg");
     db_update("uloziste", "PRIKAZ=\"screenshot\", ODPOVED=\"\", DATUM=". $cas, "ID=". $_SESSION['UZIVATEL_ID']);
  };
  
  $result="";
  $i=0;
  $chyba=false;
  
  while(!$result)
  {
     if($i>=20){$chyba=true; break;};
     
     $result=db_vypis1("ODPOVED", "historie where ( (UID=". $_SESSION['UZIVATEL_ID'] .") and (DATUM>=$cas) and (PRIKAZ=\"screenshot\") ) order by DATUM desc");
     sleep(1);
     $i++;
  };
  
  if(!$chyba)
  {
     $velikost=explode("velikost:", $result); $velikost=substr($velikost[1],0,-1);
     $velikost0=0;
     $i=0;
     
     while($velikost0!=$velikost)
     {
        if($i>=20){$chyba=true; break;};
        
        clearstatcache();
        $velikost0=(@filesize("usr/". uzivatel('LOGIN') ."/plocha.jpg")+0);
        
        sleep(1);
        $i++;
     };
  
  };
  
  
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
</head>
<body>

<script language="JavaScript">  
  <?php
    if(!$chyba)
    {
  ?>
    parent.document.nacist=true;
  <?php
    }else{
  ?>
    document.location.reload();
  <?php
    ;};
  ?>
</script>
</body>
</html>
