Skip to content

Commit

Permalink
Resolvendo [#213]
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolly015 committed Jun 6, 2024
1 parent bf20a77 commit 402e9fa
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions html/socio/sistema/controller/deletar_socios.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
<?php
require("../../conexao.php");

$resultado = false;
if(isset($_REQUEST['chave'])){
$chave = $_REQUEST['chave'];
if($chave === "h)8^#w4T<HaN-GSc&BM3[<?mvG[R?b"){
$chave_correta = "h)8^#w4T<HaN-GSc&BM3[<?mvG[R?b";

if(isset($_GET['chave'])){
$chave = $_GET['chave'];

$chave_hash = hash('sha256', $chave);
$chave_correta_hash = hash('sha256', $chave_correta);

if($chave_hash === $chave_correta_hash){
$tabelas = array("endereco","pessoafisica","pessoajuridica","socio");
$i = 0;
mysqli_query($conexao,"SET FOREIGN_KEY_CHECKS=0");
foreach ($tabelas as $n => $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");
Expand Down

0 comments on commit 402e9fa

Please sign in to comment.