From 402e9faa1cff9a0fb77317f0a91307941211f367 Mon Sep 17 00:00:00 2001 From: nicolly015 Date: Thu, 6 Jun 2024 15:26:11 -0300 Subject: [PATCH 01/13] Resolvendo [#213] --- .../sistema/controller/deletar_socios.php | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/html/socio/sistema/controller/deletar_socios.php b/html/socio/sistema/controller/deletar_socios.php index ba30f22c..330f5a57 100755 --- a/html/socio/sistema/controller/deletar_socios.php +++ b/html/socio/sistema/controller/deletar_socios.php @@ -1,15 +1,30 @@ $tabela) { - $r_query = mysqli_query($conexao, "TRUNCATE TABLE $tabela"); + $verif_tabela = mysqli_real_escape_string($conexao, $tabela); + + $r_query = mysqli_query($conexao, "TRUNCATE TABLE $verif_tabela"); if(mysqli_affected_rows($conexao)) $i++; + + if (!$r_query) { + $resultado = false; + mysqli_query($conexao, "SET FOREIGN_KEY_CHECKS=1"); + die(json_encode($resultado)); + } } $resultado = true; mysqli_query($conexao,"SET FOREIGN_KEY_CHECKS=1"); From 8287c2da7ecd5f4e2d5f513c37ee06433609bf41 Mon Sep 17 00:00:00 2001 From: nicolly015 Date: Fri, 7 Jun 2024 17:42:50 -0300 Subject: [PATCH 02/13] Resolvendo [#212] --- .../sistema/controller/editar_boletofacil.php | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/html/socio/sistema/controller/editar_boletofacil.php b/html/socio/sistema/controller/editar_boletofacil.php index 91d37e12..d34e7ae6 100755 --- a/html/socio/sistema/controller/editar_boletofacil.php +++ b/html/socio/sistema/controller/editar_boletofacil.php @@ -1,25 +1,32 @@ getMessage()); + $res = false; } + echo json_encode($res); ?> \ No newline at end of file From 1adef9e954ae69ee82f200156dad4866117db67e Mon Sep 17 00:00:00 2001 From: nicolly015 Date: Wed, 12 Jun 2024 14:39:24 -0300 Subject: [PATCH 03/13] Resolvendo [#211] --- .../sistema/controller/import_conteudo_cobrancas.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/html/socio/sistema/controller/import_conteudo_cobrancas.php b/html/socio/sistema/controller/import_conteudo_cobrancas.php index a34e72e9..262dcea6 100755 --- a/html/socio/sistema/controller/import_conteudo_cobrancas.php +++ b/html/socio/sistema/controller/import_conteudo_cobrancas.php @@ -1,7 +1,5 @@ @@ -53,12 +51,12 @@
'. $msg .'
'); }else if(isset($_GET['msg_e'])){ - $msg = $_GET['msg_e']; + $msg = htmlspecialchars($_GET['msg_e']); echo(''); From 254684144152c4a5fe5c71d27fbe88caa2bc6786 Mon Sep 17 00:00:00 2001 From: nicolly015 Date: Wed, 12 Jun 2024 15:04:58 -0300 Subject: [PATCH 04/13] Resolvendo [#210] --- .../controller/import_conteudo_gerarcontribuicao.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/html/socio/sistema/controller/import_conteudo_gerarcontribuicao.php b/html/socio/sistema/controller/import_conteudo_gerarcontribuicao.php index 8a9387f9..ed96969d 100755 --- a/html/socio/sistema/controller/import_conteudo_gerarcontribuicao.php +++ b/html/socio/sistema/controller/import_conteudo_gerarcontribuicao.php @@ -47,8 +47,14 @@ ?> prepare("SELECT *, s.id_socio as socioid FROM socio AS s LEFT JOIN pessoa AS p ON s.id_pessoa = p.id_pessoa LEFT JOIN socio_tipo AS st ON s.id_sociotipo = st.id_sociotipo LEFT JOIN (SELECT id_socio, MAX(data) AS ultima_data_doacao FROM log_contribuicao GROUP BY id_socio) AS lc ON lc.id_socio = s.id_socio WHERE s.id_socio = ?"); + $stmt->bind_param("i", $id_socio); + $stmt->execute(); + $resultado = $stmt->get_result(); + $registro = $resultado->fetch_assoc(); + $nome_socio = $registro['nome']; $email = $registro['email']; $telefone = $registro['telefone']; From 317a1da17c98371c513a9b4fd0ab2df2e1038498 Mon Sep 17 00:00:00 2001 From: nicolly015 Date: Wed, 12 Jun 2024 15:50:19 -0300 Subject: [PATCH 05/13] Resolvendo [#209] --- dao/adicionar_cargo.php | 2 +- .../controller/import_conteudo_graficos.php | 62 ++++++++++++------- 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/dao/adicionar_cargo.php b/dao/adicionar_cargo.php index 8d176bcf..b52bd687 100755 --- a/dao/adicionar_cargo.php +++ b/dao/adicionar_cargo.php @@ -1,7 +1,7 @@ query($sql); diff --git a/html/socio/sistema/controller/import_conteudo_graficos.php b/html/socio/sistema/controller/import_conteudo_graficos.php index 8d67c1c8..192581b3 100755 --- a/html/socio/sistema/controller/import_conteudo_graficos.php +++ b/html/socio/sistema/controller/import_conteudo_graficos.php @@ -62,6 +62,7 @@ $telefone"; @@ -118,6 +119,9 @@ $del_json = json_encode(array("id"=>$id,"nome"=>$nome_s,"pessoa"=>$pessoa)); echo("$id$nome_s$email$telefone$endereco$cpf_cnpj$tipo_socio"); } + } catch(Exception $e) { + throw new Exception("Erro genérico: " . $e->getMessage(), 2); + } ?> @@ -170,6 +174,7 @@

Sócios

@@ -67,7 +68,9 @@ $mensal = 0; $casual = 0; $si_contrib = 0; - $query = mysqli_query($conexao, "SELECT *, s.id_socio as socioid FROM socio AS s LEFT JOIN pessoa AS p ON s.id_pessoa = p.id_pessoa LEFT JOIN socio_tipo AS st ON s.id_sociotipo = st.id_sociotipo LEFT JOIN (SELECT id_socio, MAX(data) AS ultima_data_doacao FROM log_contribuicao GROUP BY id_socio) AS lc ON lc.id_socio = s.id_socio"); + $stmt = $conexao->prepare("SELECT *, s.id_socio as socioid FROM socio AS s LEFT JOIN pessoa AS p ON s.id_pessoa = p.id_pessoa LEFT JOIN socio_tipo AS st ON s.id_sociotipo = st.id_sociotipo LEFT JOIN (SELECT id_socio, MAX(data) AS ultima_data_doacao FROM log_contribuicao GROUP BY id_socio) AS lc ON lc.id_socio = s.id_socio"); + $stmt->execute(); + $query = $stmt->get_result(); while($resultado = mysqli_fetch_array($query)){ switch($resultado['id_sociotipo']){ case 0: case 1: @@ -95,16 +98,16 @@ $class = "bg-danger"; } } - $id = $resultado['socioid']; - $cpf_cnpj = $resultado['cpf']; - $nome_s = $resultado['nome']; - $email = $resultado['email']; - $telefone = $resultado['telefone']; - $tipo_socio = $resultado['tipo']; + $id = htmlspecialchars($resultado['socioid']); + $cpf_cnpj = htmlspecialchars($resultado['cpf']); + $nome_s = htmlspecialchars($resultado['nome']); + $email = htmlspecialchars($resultado['email']); + $telefone = htmlspecialchars($resultado['telefone']); + $tipo_socio = htmlspecialchars($resultado['tipo']); if($resultado['logradouro'] == ""){ $endereco = "Endereço não informado/incompleto."; }else{ - $endereco = $resultado['logradouro']." ".$resultado['numero_endereco'].", ".$resultado['bairro'].", ".$resultado['cidade']." - ".$resultado['estado']; + $endereco = htmlspecialchars($resultado['logradouro'])." ".htmlspecialchars($resultado['numero_endereco']).", ".htmlspecialchars($resultado['bairro']).", ".htmlspecialchars($resultado['cidade'])." - ".htmlspecialchars($resultado['estado']); } if(strlen($telefone) == 14){ @@ -144,7 +147,12 @@ - + prepare("select * from socio"); + $stmt->execute(); + $resultado = $stmt->get_result(); + $num_socios = mysqli_num_rows($resultado); + ?>
@@ -201,7 +209,9 @@ $mensal = 0; $casual = 0; $si_contrib = 0; - $query = mysqli_query($conexao, "SELECT *, sp.nome_sistema as sistema_pagamento, DATE_FORMAT(lc.data, '%d/%m/%Y') as data_geracao, DATE_FORMAT(lc.data_venc_boleto, '%d/%m/%Y') as data_vencimento, s.id_socio as socioid FROM socio AS s LEFT JOIN pessoa AS p ON s.id_pessoa = p.id_pessoa LEFT JOIN socio_tipo AS st ON s.id_sociotipo = st.id_sociotipo LEFT JOIN log_contribuicao AS lc ON lc.id_socio = s.id_socio LEFT JOIN sistema_pagamento as sp ON sp.id = lc.id_sistema WHERE s.id_socio"); + $stmt = $conexao->prepare("SELECT *, sp.nome_sistema as sistema_pagamento, DATE_FORMAT(lc.data, '%d/%m/%Y') as data_geracao, DATE_FORMAT(lc.data_venc_boleto, '%d/%m/%Y') as data_vencimento, s.id_socio as socioid FROM socio AS s LEFT JOIN pessoa AS p ON s.id_pessoa = p.id_pessoa LEFT JOIN socio_tipo AS st ON s.id_sociotipo = st.id_sociotipo LEFT JOIN log_contribuicao AS lc ON lc.id_socio = s.id_socio LEFT JOIN sistema_pagamento as sp ON sp.id = lc.id_sistema WHERE s.id_socio"); + $stmt->execute(); + $query = $stmt->get_result(); while($resultado = mysqli_fetch_assoc($query)){ $nome = $resultado['nome']; $id_log = $resultado['id_log']; From 7785db97a4527d7ae655c9bb1ced5d330ea9ef55 Mon Sep 17 00:00:00 2001 From: nicolly015 Date: Fri, 14 Jun 2024 15:31:46 -0300 Subject: [PATCH 10/13] Resolvendo [#202] --- html/socio/sistema/controller/import_head.php | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/html/socio/sistema/controller/import_head.php b/html/socio/sistema/controller/import_head.php index b531765d..637d2452 100755 --- a/html/socio/sistema/controller/import_head.php +++ b/html/socio/sistema/controller/import_head.php @@ -15,15 +15,21 @@ } $conexao = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $id_pessoa = $_SESSION['id_pessoa']; - $resultado = mysqli_query($conexao, "SELECT * FROM funcionario WHERE id_pessoa=$id_pessoa"); + $stmt = $conexao->prepare("SELECT * FROM funcionario WHERE id_pessoa=?"); + $stmt->bind_param("i", $id_pessoa); + $stmt->execute(); + $resultado = $stmt->get_result(); if(!is_null($resultado)){ - $id_cargo = mysqli_fetch_array($resultado); + $id_cargo = mysqli_fetch_assoc($resultado); if(!is_null($id_cargo)){ $id_cargo = $id_cargo['id_cargo']; } - $resultado = mysqli_query($conexao, "SELECT * FROM permissao WHERE id_cargo=$id_cargo and id_recurso=91"); + $stmt = $conexao->prepare("SELECT * FROM permissao WHERE id_cargo=? and id_recurso=91"); + $stmt->bind_param("i", $id_cargo); + $stmt->execute(); + $resultado = $stmt->get_result(); if(!is_bool($resultado) and mysqli_num_rows($resultado)){ - $permissao = mysqli_fetch_array($resultado); + $permissao = mysqli_fetch_assoc($resultado); if($permissao['id_acao'] == 1){ $msg = "Você não tem as permissões necessárias para essa página."; header("Location: ".WWW."/html/home.php?msg_c=$msg"); @@ -42,9 +48,17 @@ // Adiciona a Função display_campo($nome_campo, $tipo_campo) // Adiciona a Função display_campo($nome_campo, $tipo_campo) require_once ROOT."/html/personalizacao_display.php"; - $cargo = mysqli_query($conexao, "SELECT * FROM cargo"); - $acao = mysqli_query($conexao, "SELECT * FROM acao"); - $recurso = mysqli_query($conexao, "SELECT * FROM recurso"); + $stmt = $conexao->prepare("SELECT * FROM cargo"); + $stmt->execute(); + $cargo = $stmt->get_result(); + + $stmt = $conexao->prepare("SELECT * FROM acao"); + $stmt->execute(); + $acao = $stmt->get_result(); + + $stmt = $conexao->prepare("SELECT * FROM recurso"); + $stmt->execute(); + $recurso = $stmt->get_result(); ?> From 81e2c627365e7acd3cb09e627f1f3ab4fc4831d6 Mon Sep 17 00:00:00 2001 From: nicolly015 Date: Wed, 19 Jun 2024 11:23:55 -0300 Subject: [PATCH 11/13] Resolvendo conflito entre as branchs --- dao/adicionar_cargo.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/dao/adicionar_cargo.php b/dao/adicionar_cargo.php index b52bd687..6b5fc049 100755 --- a/dao/adicionar_cargo.php +++ b/dao/adicionar_cargo.php @@ -1,8 +1,20 @@ query($sql); + $cargo = trim($_POST['cargo']); + + if(!$cargo || empty($cargo)){ + http_response_code(400); + exit('Erro, a descrição fornecida para o cargo não pode ser vazia.'); + } + + try { + $sql = "INSERT into cargo(cargo) values(:cargo)"; + $pdo = Conexao::connect(); + $stmt = $pdo->prepare($sql); + $stmt->bindParam(':cargo', $cargo); + $stmt->execute(); + } catch (PDOException $e) { + echo 'Erro ao adicionar novo cargo: '.$e->getMessage(); + } ?> \ No newline at end of file From b5114258d6a3191e307ed301df05e2d8186d8eb2 Mon Sep 17 00:00:00 2001 From: nicolly015 Date: Wed, 19 Jun 2024 11:48:07 -0300 Subject: [PATCH 12/13] Resolvendo conflito entre as branchs --- dao/adicionar_cargo.php | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/dao/adicionar_cargo.php b/dao/adicionar_cargo.php index 6b5fc049..86dcb3d9 100755 --- a/dao/adicionar_cargo.php +++ b/dao/adicionar_cargo.php @@ -1,20 +1,8 @@ prepare($sql); - $stmt->bindParam(':cargo', $cargo); - $stmt->execute(); - } catch (PDOException $e) { - echo 'Erro ao adicionar novo cargo: '.$e->getMessage(); - } + $sql = "INSERT into cargo(cargo) values('" .$cargo ."')"; + $pdo->query($sql); ?> \ No newline at end of file From 85b7285d67e817b312fe8e8e7401fee27a7b5bca Mon Sep 17 00:00:00 2001 From: nicolly015 Date: Wed, 19 Jun 2024 11:52:31 -0300 Subject: [PATCH 13/13] Resolvendo conflito entre as branchs --- dao/adicionar_cargo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dao/adicionar_cargo.php b/dao/adicionar_cargo.php index 86dcb3d9..350de429 100755 --- a/dao/adicionar_cargo.php +++ b/dao/adicionar_cargo.php @@ -1,5 +1,5 @@