<?php $toRoot = isset($toRoot) ? $toRoot : "../"; include_once $toRoot . "beans/Servico.class.php"; include_once $toRoot . "dao/DAOServico.class.php"; include_once $toRoot . "utils/ConectarMySQL.class.php"; $conexao = new ConectarMySql($toRoot); $bean = new Servico(); $dao = new DAOServico($bean, $conexao); $array = $dao->getServicoLista(); if ($array != NULL) { echo '<option value="---" selected="selected" >----------</option>'; foreach ($array as $temp) { $bean = $temp; echo '<option value="' . $bean->codigo . '" >' . $bean->descricao . '</option>'; } } else { echo '<option value="---" selected="selected" >Não há serviços cadastrados!</option>'; } $conexao->fechar();
<?php session_start(); $toRoot = "../../"; $nivelAcesso = $toRoot . ":1:4"; include_once $toRoot . "utils/controladorAcesso.php"; include_once $toRoot . "utils/funcoes.php"; setVoltar("cadServico.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/Servico.class.php"; include_once $toRoot . "beans/Log.class.php"; include_once $toRoot . "dao/DAOServico.class.php"; include_once $toRoot . "dao/DAOLog.class.php"; $conexao = new ConectarMySql($toRoot); $servido = new Servico($tfDes); $daoServico = new DAOServico($servido, $conexao); $daoServico->cadastrar(); $log = new Log(3, 13, $tfDes . " cadastrado!"); $daoLog = new DAOLog($log, $conexao); $daoLog->cadastrar(); $conexao->fechar(); $cadastrar = true; }