<?php
// variávis que se trabalham nessa página
$var_banco = "usuario_sistema";
$var_pagina = "usuarios-excluidos"
?>
<section class="content" >
<!-- Info boxes -->
<section class="content-header">
<h1>
Gerenciamento de Usuários <strong>[Usuários já Excluídos]</strong>
</h1>
<br />
<div style="text-align:right">
<a href="?secao=usuarios" class="btn btn-lg btn-default"><i class="fa fa-user-times"></i> Usuários Ativos</a>
<a href="?secao=usuarios-cadastrar" class="btn btn-lg btn-success"><i class="fa fa-plus"></i> CADASTRAR NOVO</a>
</div>
<br />
<?php
// EXCLUINDO
if ($_REQUEST[sub] == "excluir"){
print ' <div class="alert alert-warning" role="alert">
<a class="close" data-dismiss="alert" href="#">×</a>
<strong>Confirme</strong> a exclusão definitiva.<br><br>
<a class="btn btn-danger " href="index2.php?secao='.$var_pagina.'&sub=confirmar&id='.$_REQUEST[id].'">Excluir</a>
<a class="btn btn-primary" data-dismiss="alert" >Cancelar</a>
</div>';
}else if ($_REQUEST[sub] == "confirmar"){
$comando = "UPDATE ". $var_banco ."
SET status=2
WHERE id=".$_REQUEST[id]; //comando SQL
$exec = mysql_query($comando); //executa o comando no banco
print "<div class=\"alert alert-success\">
<a class=\"close\" data-dismiss=\"alert\" href=\"#\">×</a>
Excluído com <strong>sucesso</strong>.
</div>";
}
//////////////////
// REATIVAR
if ($_REQUEST[sub] == "reativar"){
$comando = "UPDATE ". $var_banco ."
SET status=1
WHERE id=".$_REQUEST[id]; //comando SQL
$exec = mysql_query($comando); //executa o comando no banco
print "<div class=\"alert alert-success\">
<a class=\"close\" data-dismiss=\"alert\" href=\"#\">×</a>
Reativado com <strong>sucesso</strong>.
</div>";
}
//////////////////
//********** BUSCA TODOS **********
$comando = "SELECT * FROM ". $var_banco ." WHERE status = 0 ORDER BY nome";
$exec = mysql_query($comando);
?>
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Usuários excluídos/banidos</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<table class="table table-bordered">
<tbody><tr>
<th style="width: 20px">ID</th>
<th>Nome</th>
<th>Permissão</th>
<th>CPF</th>
<th style="width:100px">Ação</th>
</tr>
<?php
while ($linha = mysql_fetch_assoc($exec)) {
?>
<tr>
<td><?php echo $linha[id];?></td>
<td><?php echo $linha[nome];?></td>
<td><?php echo $linha[permissao];?></td>
<td><?php echo $linha[cpf];?></td>
<td>
<a href="index2.php?secao=<?php echo $var_pagina;?>&sub=reativar&id=<?php echo $linha[id];?>" class="btn btn-success btn-xs" title="Reativar">
<span class="glyphicon glyphicon-ok"></span>
</a>
<a href="index2.php?secao=<?php echo $var_pagina;?>&sub=excluir&id=<?php echo $linha[id];?>" class="btn btn-danger btn-xs" title="Excluir de vez">
<span class="glyphicon glyphicon-remove"></span>
</a>
</td>
</tr>
<?php
} //while
?>
</tbody></table>
</div>
<!-- /.box-body -->
</div>
</section>
</section>