<?php
include("./inc/func.php");

if(@$_GET['ID'])
{
   $ID=$_GET['ID'];
};

if(!isset($ID))
{
   if(!@$_SESSION['UZIVATEL_ID'])
   {
      $ID="guest_login";
   }else{
      $ID="user_main";
   };
};
//PRIHLASENI
if(isset($_POST['PRIHLASIT'])){
  $result=db_vypis1("ID", "hesla where((LOGIN=\"". @$_POST['LOGIN'] ."\")and ((IP=\"\")or(IP=\"". $_SERVER['REMOTE_ADDR'] ."\")) and (HESLO=\"". md5(@$_POST['HESLO']) ."\"))");
  
  if($result)
  {
     $_SESSION['UZIVATEL_ID']=$result;
     $ID="user_main";
     
     db_update("hesla", "IP=\"". $_SERVER['REMOTE_ADDR'] ."\", DATUM=". time(), "ID=". $_SESSION['UZIVATEL_ID']);
  }else{
     $chyba['guest_login']=true;
  };
};
//PRIHLASENI_konec
//ODHLASENI
if($ID=='odhlasit'){
  db_update("hesla", "IP=\"\"", "ID=". $_SESSION['UZIVATEL_ID']);
  db_update("uloziste", "PRIKAZ=\"\",ODPOVED=\"\",IP=\"\",JMENO=\"\",CAS=0,LOCAL_IP=\"\",LOCAL_JMENO=\"\",OS=\"\",ROZLISENI=\"\",PAMET=\"\",CPU=\"\"","ID=". $_SESSION['UZIVATEL_ID']);
  unset($_SESSION['UZIVATEL_ID']);
  $ID="guest_login";
};
//ODHLASENI_konec
//REGISTRACE
if(isset($_POST['REGISTROVAT'])){
  if(strlen(trim(@$_POST['HESLO']))<4)
  {
     $chyba['guest_reg']['HESLO']='minimálně 4 znaky';
  };
  
  if(@$_POST['HESLO2']!=@$_POST['HESLO'])
  {
     $chyba['guest_reg']['HESLO2']='hesla nejsou stejná';
  };
  
  if(!strlen(trim(@$_POST['LOGIN'])))
  {
     $chyba['guest_reg']['LOGIN']='není vyplněno';
  }else{
     $result=db_vypis1("ID", "hesla where LOGIN=\"". trim(@$_POST['LOGIN']) ."\"");
     
     if($result)
     {
        $chyba['guest_reg']['LOGIN']='již obsazen';
     };
  };
  
  if(!count(@$chyba['guest_reg']))
  {
     $_SESSION['UZIVATEL_ID']=db_insert("hesla", "LOGIN=\"". trim($_POST['LOGIN']) ."\", HESLO=\"". md5(trim($_POST['HESLO'])) ."\", IP=\"". $_SERVER['REMOTE_ADDR'] ."\", DATUM=". time());
     db_insert("uloziste", "ID=". $_SESSION['UZIVATEL_ID'] .", PRIKAZ=\"help\", ODPOVED=\"\"");     
     @mkdir("usr/".uzivatel('LOGIN'), 0777);
     
     $ID="user_main";
  }else{
     $ID="guest_reg";
  };
  
};
//REGISTRACE_konec
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=windows-1250">
    <meta name="generator" content="PSPad editor, www.pspad.com">
    <title> Rem¤te - otruba.eu
    </title>
    <style>
      <!--
      
      A:link {text-decoration: none; color:#00f; font-weight: bold;}
      A:visited {text-decoration: none; color:#00f; font-weight: bold;}
      A:active {text-decoration: none; color:#00f; font-weight: bold;}
      A:hover {text-decoration: underline; color:  #0f3461; font-weight: bold;}
      
      body  {margin: 0px; background-image: url('img/bg.png'); font-family: Arial;}
      div {font-size: 10px; color: #000;}
      
      input {width: 100px;}
      
      .tlacitko { background-image: url('img/button.png'); background-color: #2d65ff; width: 53px; height: 41px; *width: 55px; *height: 43px;}
      
      .tlacitko2 { background-color: #6d92fc; width: 60px; height: 20px; color: #fff; font-size: 10px; padding-top: 1px; font-weight: bold; display: block; margin-bottom: 10px; margin-left: 15px;}
      
      .tlacitko3 { background-color: #2d65ff; width: 28px; height: 30px; background-repeat: no-repeat; margin-top: 10px; font-size: 0px; }
      
      .nadpis_navigace {font-size: 11px; font-weight: bold; background-color: #fff; padding-left: 5px; padding-top: 2px; padding-bottom: 2px;}
      
      .chyba {color: #f00; position: absolute;}
      
      .cmd_line {position: absolute; left: 125px; top: 30px; width: 295px; *width: 300px; height: 300px;}
      
      .levy_panel {position: absolute; top: 30px; left: 12px; width: 100px; height: 297px;}
      
      .pravy_panel {position: absolute; top: 30px; right: 12px; text-align: left; width: 100px; padding-left: 4px; }
      -->
    </style>
    <script language="JavaScript">
    
      function prikaz(pprikaz)
      {
         document.getElementById('CMD').value=pprikaz;
         document.getElementById('form1').submit();
      };
      
      function okno(ukazatel,fileName,windowWidth,windowHeight)
      {
         var d = new Date();
         var t = d.getTime();
         
         newWindow = window.open(fileName + "?cas=" + t,ukazatel,"width="+windowWidth+",height="+windowHeight+",resizable=yes,scrollbars=yes");
	       newWindow.focus();
      };
      
      function okno_full(ukazatel,fileName)
      {
         var d = new Date();
         var t = d.getTime();
         
         newWindow = window.open(fileName + "?cas=" + t,ukazatel,"fullscreen,scrollbars=yes");
	       newWindow.focus();
      };
    
    </script>
  </head>
  <body>
    <table width="100%" height="100%">
      <tr>
        <td align="center" valign="middle">
          <div style="border: 1px solid #ccc; width: 550px;">
            <a href="?" title="home">
              <div style="position: relative; top: 0px; width: 550px; height: 71px; background-image: url('img/head.png'); cursor: pointer;">
                <?php /*  Hlavicka */ ?>
                <div align="right" style="position: absolute; bottom: 1px; right: 3px;">
<?php
                if(@$_SESSION['UZIVATEL_ID'])
                {
                  ?>
                  <a href="?ID=odhlasit" style="color: white; font-weight: bold;" title="odhlásit">
                    <?php echo uzivatel("LOGIN"); ?></a>
<?
                }else{
                  ?>
                  <a href="?ID=guest_login" style="color: white; font-weight: bold;" title="přihlásit">nepřihlášen</a>
<?php
                ;};
                  ?>
                </div>
              </div></a>
            <div style="position: relative; top: 0px; width: 550px; height: 429px; background-image: url('img/main_bg.png'); text-align: left;">
              <?php /*  Telicko */ ?>
<?php
                include('./'. $ID .'.php');
              ?>
              <div align="right" style="position: absolute; bottom: -14px; right: 0px;">
                <a href="mailto:vita@otruba.eu" style="color: #0f3461;" title="admin">vita@otruba.eu</a>
              </div>
            </div>
          </div></td>
      </tr>
    </table>
  </body>
</html>
