<?php
//require("config.php");
//require("includes/logincheck.php");
/* if (isset($_POST["Limpar"])) {
  $conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
  var_dump($conn);
  exit("Lixeira");
  $diasAntes = date("Y-m-d H:i:s", strtotime("-7 day"));
  $strDel = "DELETE FROM cmum_udb WHERE expiredate < '{$diasAntes}'";
  $status = "Dados";
  if ($conn->query($strDel)) {
  $status = "Dados Limpados Com Sucesso..";
  }
  } */
?>
<table width="980" height="20" border="0" align="center" valign="top" cellpadding="0" cellspacing="0" style="border-left: 0px solid #DDDDDD; border-right: 0px solid #DDDDDD; text-align: left;">
    <?php if (isset($status) && $status != ""): ?>

        <tr>
            <td><div class="alert alert-success"><?php echo $status; ?></div></td>
        </tr>
    <?php endif; ?>
    <tr>
        <td>
            <fieldset>
                <form method="post">
                    <legend>Lixeira</legend>   
                    <div class="form-group" style="width: 20%"> 
                        <label>Limpar de:</label>    
                        <select name="adias" class="form-control ">
                            <option value="3" <?php if (isset($_POST["adias"]) and $_POST["adias"] == 3) echo 'selected=""'; ?>>3 dias atrás</option>
                            <option value="7" <?php if (isset($_POST["adias"]) and $_POST["adias"] == 7) echo 'selected=""'; ?>>7 dias atrás</option>
                            <option value="30" <?php if (isset($_POST["adias"]) and $_POST["adias"] == 30) echo 'selected=""'; ?>>30 dias atrás</option>
                            <option value="60" <?php if (isset($_POST["adias"]) and $_POST["adias"] == 60) echo 'selected=""'; ?>>60 dias atrás</option>
                        </select>
                    </div>
                    <div class="form-group" style="width: 20%">  
                        <label>Revenda:</label>  
                        <select name='p' class='form-control' id="_p">
                            <?php
                            $json["id"] = "{$_SESSION['adminid']}";
                            $p = base64_encode(json_encode($json));
                            $json["id"] = "0";
                            $p_2 = base64_encode(json_encode($json));
                            ?>
                            <option value="<?php echo $p_2 ?>">Todas</option>
                            <option value="<?php echo $p ?>"><?php echo $_SESSION['loginuser'] ?></option>
                            <?php
                            $arvore = arvoreRevendas2();
                            $arvore_lista = arvoreRevendasLista();
                            listaOptionsRenvendas($arvore[$_SESSION['adminid']], $arvore_lista, isset($_GET['_p']) ? $_GET['_p'] : "", $_SESSION['_hierarquia']);
                            ?>
                        </select> 
            <!--<input class="form-control numeros" name="novo_valor_cob" id="novo_valor_cob" maxlength="8"/>-->
                    </div>
                    <div class="form-group">
                        <input type="radio" name="opc_logins" value="1" <?php if(isset($_POST['opc_logins']) && $_POST['opc_logins'] == 1 || !isset($_POST['opc_logins'])):?>checked<?php endif;?>/>Desativados&nbsp;<input type="radio"  name="opc_logins" value="2" <?php if(isset($_POST['opc_logins']) && $_POST['opc_logins'] == 2):?>checked<?php endif;?>/>Vencidos                       
                    </div>
                    <div class="form-group">
                        <input type="submit" name="Limpar" value="Limpar" class="btn btn-default" />
                    </div>

                </form>
            </fieldset>
        </td>
    </tr>
</table>
