<?php session_start(); $nivelAcesso = "../../:2:3:4"; include_once "../../utils/controladorAcesso.php"; include_once "../../utils/funcoes.php"; $tfProDesc = antiSQL(isset($_POST["tfProDesc"]) ? $_POST["tfProDesc"] : NULL); $tfProPrazMax = antiSQL(isset($_POST["tfProPrazMax"]) ? $_POST["tfProPrazMax"] : NULL); if ($tfProDesc != NULL && $tfProPrazMax != NULL) { include_once "../../utils/ConectarMySQL.class.php"; $conexao = new ConectarMySQL(); include_once "../../dao/DAOProduto.class.php"; $dao = new DAOProduto($tfProDesc, $tfProPrazMax, "../../", $conexao); include_once "../../dao/DAOLog.class.php"; $log = new DAOLog($_SESSION["pessoa"], 3, $_SESSION["nivel"], $_SESSION["codigo"], 4, "valor=\\'" . $tfProDesc . "\\'", "../../", $conexao); if ($dao->cadastrar() && $log->cadastrar()) { $conexao->commit(); } else { $conexao->rollback(); } header("Location: cadProduto.php?cad=ok"); die; } $cad = antiSQL(isset($_GET["cad"]) ? $_GET["cad"] : NULL); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style type="text/css">
<?php session_start(); $toRoot = "../../"; $nivelAcesso = $toRoot . ":1:3:4"; include_once $toRoot . "utils/controladorAcesso.php"; include_once $toRoot . "utils/funcoes.php"; setVoltar("cadProduto.php"); $voltar = $_SESSION["voltar"]; $cadastrar = isset($_GET["cadastrar"]) ? $_GET["cadastrar"] : NULL; if ($cadastrar == "sim") { foreach ($_POST as $nomeCampo => $valor) { $comando = "\$" . $nomeCampo . "= antiSQL(isset(\$_POST['{$nomeCampo}']) ? '" . $valor . "' : NULL);"; eval($comando); } include_once $toRoot . "utils/ConectarMySQL.class.php"; include_once $toRoot . "beans/Produto.class.php"; include_once $toRoot . "beans/Log.class.php"; include_once $toRoot . "dao/DAOProduto.class.php"; include_once $toRoot . "dao/DAOLog.class.php"; $conexao = new ConectarMySql($toRoot); $tfVal = converterValor($tfVal); $produto = new Produto($slEmp, $tfDes, $tfMod, $tfVal); $daoProduto = new DAOProduto($produto, $conexao); $daoProduto->cadastrar(); $log = new Log(3, 16, $tfDes . " cadastrado!"); $daoLog = new DAOLog($log, $conexao); $daoLog->cadastrar(); $conexao->fechar(); $cadastrar = true; }