Esempio n. 1
0
 $dao->zerar();
 $conexao->commit();
 for ($x = 0; $x < $nLinhas; $x++) {
     $conexao = new ConectarMySQL();
     $comitar = true;
     $campo = $matriz[$x];
     $pEmpresa = $campo[0];
     $pNome = utf8_encode($campo[1]);
     $pCPF = substr($campo[2], 0, 14);
     $sMatricula = str_replace(" ", "", $campo[3]);
     $sAdmissao = substr($campo[4], 0, 4) . "/" . substr($campo[4], 4, 2) . "/" . substr($campo[4], 6, 2);
     $sCargo = $campo[5];
     $sVinculo = $campo[6];
     $sConsignavel = $campo[7];
     $dao = new DAOPessoa($pNome, $pCPF, "S", "../", $conexao);
     $linha = mysqli_fetch_array($dao->pesquisar($pNome . ":" . $pCPF . ":S"));
     $existe = $linha["pes_codigo"];
     if (strlen($existe) > 0) {
         $log = new DAOLog($_SESSION["pessoa"], 4, $_SESSION["nivel"], $_SESSION["codigo"], 5, "nome=\\'" . $pNome . "\\'", "../", $conexao);
         if (!$dao->alterar($existe)) {
             $comitar = false;
             //echo($campo[1]);
         }
     } else {
         $log = new DAOLog($_SESSION["pessoa"], 3, $_SESSION["nivel"], $_SESSION["codigo"], 5, "nome=\\'" . $pNome . "\\'", "../", $conexao);
         if (!$dao->cadastrar()) {
             $comitar = false;
             //echo($campo[1]);
         }
         $linha = mysqli_fetch_array($dao->pesquisar($pNome . ":" . $pCPF . ":S"));
         $pesCod = $linha["pes_codigo"];
Esempio n. 2
0
 $pesCod = NULL;
 if ($tfNome != NULL || $tfCPF != NULL) {
     if (strlen($tfCPF) == 0) {
         $tfCPF = NULL;
     }
     include_once "../../dao/DAOPessoa.class.php";
     $dao = new DAOPessoa($tfNome, $tfCPF, $classe, "../../", $conexao);
     include_once "../../dao/DAOLog.class.php";
     $log = new DAOLog($_SESSION["pessoa"], 3, $_SESSION["nivel"], $_SESSION["codigo"], 5, "nome=\\'" . $tfNome . "\\'", "../../", $conexao);
     if (!$dao->cadastrar() || !$log->cadastrar()) {
         $comitar = false;
     }
     if ($tfCPF == NULL) {
         $tfCPF = "%";
     }
     $linha = mysqli_fetch_array($dao->pesquisar($tfNome . ":" . $tfCPF . ":" . $classe));
     $pesCod = $linha["pes_codigo"];
 } else {
     $comitar = false;
 }
 for ($x = 1; $x < $tfFoneCont + 1; $x++) {
     eval("\$tfPesFone[{$x}] = isset(\$_POST[\"tfPesFone{$x}\"]) ? \$_POST[\"tfPesFone{$x}\"] : NULL;");
     if ($tfPesFone[$x] != NULL && preg_match("/^[0-9]{2,2}-[0-9]{4,4}-[0-9]{4,4}\$/", $tfPesFone[$x])) {
         include_once "../../dao/DAOTelefone.class.php";
         $dao = new DAOTelefone($pesCod, $tfPesFone[$x], "../../", $conexao);
         include_once "../../dao/DAOLog.class.php";
         $log = new DAOLog($_SESSION["pessoa"], 3, $_SESSION["nivel"], $_SESSION["codigo"], 6, "numero=\\'" . $tfPesFone[$x] . "\\'", "../../", $conexao);
         if (!$dao->cadastrar() || !$log->cadastrar()) {
             $comitar = false;
         }
     } else {
Esempio n. 3
0
if ($tfBanCod != NULL && $tfBanDesc != NULL) {
    include_once "../../utils/ConectarMySQL.class.php";
    $conexao = new ConectarMySQL();
    $comitar = true;
    if ($cbNovoContat == "novo") {
        $tfBanContat = antiSQL(isset($_POST["tfBanContat"]) ? $_POST["tfBanContat"] : NULL);
        $tfFoneCont = antiSQL(isset($_POST["tfFoneCont"]) ? $_POST["tfFoneCont"] : NULL);
        if ($tfBanContat != NULL) {
            include_once "../../dao/DAOPessoa.class.php";
            $dao = new DAOPessoa($tfBanContat, NULL, "B", "../../", $conexao);
            include_once "../../dao/DAOLog.class.php";
            $log = new DAOLog($_SESSION["pessoa"], 3, $_SESSION["nivel"], $_SESSION["codigo"], 5, "nome=\\'" . $tfBanContat . "\\'", "../../", $conexao);
            if (!$dao->cadastrar() || !$log->cadastrar()) {
                $comitar = false;
            }
            $resultado = $dao->pesquisar($tfBanContat . ":%:B");
            $linha = mysqli_fetch_array($resultado);
            $tfBanContat = $linha["pes_codigo"];
        } else {
            $comitar = false;
        }
        for ($x = 1; $x < $tfFoneCont + 1; $x++) {
            eval("\$tfPesFone[{$x}] = isset(\$_POST[\"tfPesFone{$x}\"]) ? \$_POST[\"tfPesFone{$x}\"] : NULL;");
            if ($tfPesFone[$x] != NULL && preg_match("/^[0-9]{2,2}-[0-9]{4,4}-[0-9]{4,4}\$/", $tfPesFone[$x])) {
                include_once "../../dao/DAOTelefone.class.php";
                $dao = new DAOTelefone($tfBanContat, $tfPesFone[$x], "../../", $conexao);
                include_once "../../dao/DAOLog.class.php";
                $log = new DAOLog($_SESSION["pessoa"], 3, $_SESSION["nivel"], $_SESSION["codigo"], 6, "numero=\\'" . $tfPesFone[$x] . "\\'", "../../", $conexao);
                if (!$dao->cadastrar() || !$log->cadastrar()) {
                    $comitar = false;
                }