<?php require_once "Mep/init.php"; use Mep\Handlers\FiltroPost as Post; if ($_SERVER["REQUEST_METHOD"] === "POST") { if (Mep\Container::getToken()->checa(Post::TOKEN())) { try { Mep\Container::getFormRegistro(['matricula', 'nome'], 'Aluno')->prepara()->processa(); } catch (Exception $ex) { die($ex->getMessage()); } } else { Mep\Container::getToken()->flush(); header('Location:demo_banco.php'); die; } } ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Update, Insert and Delete</title> </head> <body> <form action="" method="post"> <div> Matricula:<input type="text" name="matricula" value="<?php echo Post::MATRICULA(); ?> ">
<?php header('Content-Type: application/json'); require_once 'Mep/init.php'; use Mep\Container as Mep, Mep\Handlers\FiltroPost as Post; if (Mep::getToken()->checa(Post::TOKEN())) { $token = Mep::getLayout()->renderSecurityField(); try { $mail = Mep::getFormContato(['nome', 'telefone', 'email', 'assunto', 'mensagem'])->prepara()->processa(); $mail("*****@*****.**", "Marcos Ammon"); $status = "Email enviado com sucesso"; } catch (Exception $ex) { $status = $ex->getMessage(); } echo \json_encode(["status" => $status, "novoToken" => $token]); } else { Mep::getLayout()->renderNotFound(); die; }