Mini Shell
<?php include('header.php') ?>
<?php
$user = new User();
$flash = array();
// CREATE
if(isset($_POST['action']) && $_POST['action'] == 'create'):
unset($_POST['action']);
if(strlen($_POST['name']) > 1 && strlen($_POST['email']) > 5 && strlen($_POST['password']) >= 6):
$_POST['password'] = Helper::hash($_POST['password']);
if($user->create($_POST)):
$flash = Helper::flash('success');
else:
$flash = Helper::flash('error');
endif;
else:
$flash = Helper::flash('error');
endif;
endif;
?>
<div id="page">
<div class="row">
<div class="col lg-12">
<h2>Administradores / adicionar</h2>
</div>
</div>
<div class="row">
<?php if($flash): ?>
<div class="col-lg-12">
<div class="alert alert-<?= $flash['class'] ?> alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?= $flash['message'] ?>
</div>
</div>
<?php endif ?>
<div class="col-lg-12">
<a href="users.php" class="btn btn-primary">Voltar</a>
<hr>
<small>* todos os campos são obrigatórios</small>
<form action="" method="post">
<div class="form-group">
<label for="name">Nome:</label>
<input type="text" name="name" class="form-control" required>
</div>
<div class="form-group">
<label for="email">E-mail:</label>
<input type="email" name="email" class="form-control" required>
</div>
<div class="form-group">
<label for="password">Senha: <small>(tamanho mínimo 6 caracteres)</small></label>
<input type="password" name="password" class="form-control" required>
</div>
<div class="form-group">
<input type="hidden" name="action" value="create">
<button type="submit" class="btn btn-primary">Adicionar</button>
</div>
</form>
</div>
</div>
</div>
<?php include('footer.php') ?>
Zerion Mini Shell 1.0