<?php
if(isset($_SESSION['user_id']) AND (substr($_SERVER['PHP_SELF'], -10) != 'iesire.html')) {
    $url = PATH.'index.html';
    ob_end_clean();
    header("Location: $url");
    exit();
    }else{
    ?>
<?php include FORM; ?>
<div class="w3-row-padding">
<div class="w3-quarter">
<?php include APP.'sidebar_gen.php'; ?>
</div>
<div class="w3-threequarter"> 
 
 <div class="w3-row">
 
 <div class="w3-quarter w3-hide-small">&nbsp;</div>
        
   <div class="w3-half w3-text-white w3-container w3-margin-top w3-margin-bottom w3-card" style="background-color:#117594;">
   <h3 class="w3-center w3-margin-bottom w3-padding w3-border-bottom">Cont nou</h3>

<?php if(isset($exista)) {?>   
   <div class="w3-container">
       <div class="w3-panel w3-red w3-center">
            <h5 style="margin-top:4px;"><?=$exista?></h5>
       </div>
   </div>
<?php } ?>
   
<?php if(isset($e_err)) {?>
   <div class="w3-container">
       <div class="w3-panel w3-red w3-center">
            <h5 style="margin-top:4px;"><?=$e_err?></h5>
       </div>
   </div>
<?php } ?>

<?php if(isset($err_p1)) {?>
   <div class="w3-container">
       <div class="w3-panel w3-red w3-center">
            <h5 style="margin-top:4px;"><?=$err_p1?></h5>
       </div>
   </div>
<?php } ?>

<?php if(isset($err_p2)) {?>
   <div class="w3-container">
       <div class="w3-panel w3-red w3-center">
            <h5 style="margin-top:4px;"><?=$err_p2?></h5>
       </div>
   </div>
<?php } ?>

<?php if(isset($finalizat)) {?>
   <div class="w3-container">
       <div class="w3-panel w3-green w3-center">
            <?=$finalizat?>
       </div>
   </div>
<?php } ?>

<?php if(isset($sys_err)) {?>
   <div class="w3-container">
       <div class="w3-panel w3-red w3-center">
            <h5 style="margin-top:4px;"><?=$sys_err?></h5>
       </div>
   </div>
<?php } ?>

<?php if(isset($try)) {?>
   <div class="w3-container">
       <div class="w3-panel w3-red w3-center">
            <h5 style="margin-top:4px;"><?=$try?></h5>
       </div>
   </div>
<?php } ?>
   
   <form class="w3-container" action="" method="post">
   <div class="w3-margin-bottom">
   <label>Adresa de e-mail</label>
   <input class="w3-input" type="email" name="email" value="<?php if(isset($trimmed['email'])) echo $trimmed['email']; ?>" placeholder="Treceți adresa dvs. de e-mail" required=""/>
   </div>
   
   <div class="w3-margin-bottom">
   <label>Parola</label>
   <input class="w3-input" type="password" name="parola1" value="<?php if (isset($trimmed['parola1'])) echo $trimmed['parola1']; ?>" placeholder="Introduceți parola" required=""/>
   </div>
   
   <div class="w3-margin-bottom">
   <label>Verificare parolă</label>
   <input class="w3-input" type="password" name="parola2" value="<?php if (isset($trimmed['parola2'])) echo $trimmed['parola2']; ?>" placeholder="Re-introduceți parola" required=""/>
   </div>
   
   <div class="w3-margin-bottom">
   <span><strong>Sunt de acord cu:</strong> </span><br/>
   <input class="w3-check" type="checkbox" name="atermeni" value="0" id="checkTenable"/>
   <label><a href="<?=PATH?>termeni.html" target="_blank" class="w3-text-white" style="text-decoration:none;">Termenii și Condițiile</a></label><br/>
   
   <input class="w3-check" type="checkbox" name="apolitica" value="0" id="checkGenable" disabled="disabled"/>
   <label><a href="<?=PATH?>confidentialitate.html" target="_blank" class="w3-text-white" style="text-decoration:none;">Politica de confidențialitate</a></label><br/>
   
   <input class="w3-check" type="checkbox" name="astiri" value="0"/>
   <label>Abonarea la știri</label>
   </div>
   
   <div class="w3-margin-bottom w3-center">
   <button class="w3-button w3-green w3-hover-blue" type="submit" id="ischeckenable" disabled="disabled"><i class="fa fa-unlock"></i> Înregistrare</button>
   </div>
   
   <input type="hidden" name="contnou" value="true"/>
   </form>
   
   <div class="w3-bar w3-white w3-hide-small_ w3-border-top">
   
   <a href="<?=PATH?>acces.html" class="w3-bar-item w3-button w3-text-white w3-hover-teal" style="width:40%;background-color:#117594;">Acces</a>
   <a href="<?=PATH?>recuperareparola.html" class="w3-bar-item w3-button w3-text-white w3-hover-teal" style="width:60%;background-color:#117594;">Recuperare parolă</a>
   
   </div>
   
   </div>
   
   <div class="w3-quarter w3-hide-small">&nbsp;</div>
   
 </div>

</div>

</div>

<script>
$(function() {
    $('#checkTenable').click(function() {
        if ($(this).is(':checked')) {
            $('#checkGenable').removeAttr('disabled');
        } else {
            $('#checkGenable').attr('disabled', 'disabled');
            $('#ischeckenable').attr('disabled', 'disabled');
        }
    });
    
    $('#checkGenable').click(function() {
        if ($(this).is(':checked')) {
            $('#ischeckenable').removeAttr('disabled');
        } else {
            $('#ischeckenable').attr('disabled', 'disabled');
        }
    });
});
</script>
<?php } ?>