if ($permissao->login() != true) { echo "Acesso negado"; exit; } else { $resultado = array(); if (!empty($_POST)) { $poste = $_POST; $where = json_decode(base64_decode($poste['where']), true); $tabela = base64_decode($poste['tabela']); $ob = $banco->seleciona($tabela, $where); if (!empty($ob)) { $dados = $ob[0]; if (!empty($dados->foto)) { if (file_exists("../../uploads/" . $tabela . "/" . $dados->foto)) { unlink("../../uploads/" . $tabela . "/" . $dados->foto); } } $banco->apaga($tabela, $where); if ($poste['tambem'] != "") { $tambem = json_decode(base64_decode($poste['tambem']), true); if (!empty($tambem['tabela']) && !empty($tambem['where'])) { $tambem_tabela = $tambem['tabela']; $tambem_where = $tambem['where']; $banco->apaga($tambem_tabela, $tambem_where); } } $resultado["msg"] = "sucesso"; } } echo json_encode($resultado); }
<div class="col-lg-12"> <br> <button type="submit" class="btn btn-primary">ENVIAR</button> </div> </form> <?php } else { echo '<div class="alert alert-dismissable alert-danger"><button type="button" class="close" data-dismiss="alert">×</button>Permissão negada !</div>'; } } elseif ($execulta == 'deleta') { if (NIVEL_USUARIO == 5) { $id = isset($_GET['id']) ? addslashes($_GET['id']) : ""; if ((int) $id) { $del = $base->apaga($tabela, array('ID' => $id)); if ($del) { ?> <script>window.location = "index.php<?php echo adiciona_ao_get(array('exe' => 'lista')); ?> ";</script> <?php } } } else { echo '<div class="alert alert-dismissable alert-danger"><button type="button" class="close" data-dismiss="alert">×</button>Permissão negada !</div>'; } ?> <?php