public function destroy_session() { if (session_id() == '' || !isset($_SESSION)) { session_start(); } $bd = new BD(); $bd->record_log("log_login", 'logout'); session_destroy(); header('Location:' . $this->session_out); exit; }
<?php /** * Created by PhpStorm. * User: rodrigo.martins * Date: 22/01/2016 * Time: 16:57 */ include_once "first_all.php"; $bd = new BD(); $table = "parceiros"; $dados['ativo'] = "false"; $where = "codigo=" . $_GET['codigo']; $bd->update($table, $dados, $where); $bd->record_log("log_login", 'delete_parceiro', $_GET['codigo']); header('Location: ../pages/parceiros.php');
<?php /** * Created by PhpStorm. * User: rodrigo.martins * Date: 21/01/2016 * Time: 10:47 */ include_once "first_all.php"; if (isset($_POST) && $_POST != "") { $bd = new BD(); $bd->start_transaction(); $table = "aplicacao"; if ($_POST['id'] == 0) { $dados['ativo'] = "true"; $bd->insert($table, $dados); $_POST['id'] = $bd->get("insert_id"); } $dados = $_POST; unset($dados['id']); $dados['descricao'] = "'" . $dados['descricao'] . "'"; $where = "codigo={$_POST['id']}"; $bd->update($table, $dados, $where); $bd->record_log("log_login", 'update_aplicacao', $_POST['id']); $bd->commit(); header('Location: ../pages/geral.php'); }
if (file_exists($target_file)) { echo "Desculpe, esse arquivo já existe."; $uploadOk = 0; } // Allow certain file formats if ($imageFileType != "pdf") { echo "Desculpe, somente arquivos PDF são permitidos."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Desculpe, não foi possível subir seus arquivos."; exit; // if everything is ok, try to upload file } else { if (move_uploaded_file($_FILES["arquivo_pdf"]["tmp_name"][$i], $target_file)) { //INSERT - produto_midia (downloads) $table4 = "produto_midia"; $dados4 = array("cod_produto" => $_POST['id'], "tipo" => 'download', "url" => $target_file, "titulo" => $name); $bd->insert($table4, $dados4); } else { echo "Desculpe, ocorreu algum erro durante o uploading do seu arquivo."; exit; } } } } $bd->record_log("log_login", 'update_produto', $_POST['id']); $bd->commit(); header('Location: ../pages/detalhe_produto.php?codigo=' . $_POST['id']); }
<?php /** * Created by PhpStorm. * User: rodrigo.martins * Date: 21/01/2016 * Time: 10:47 */ include_once "first_all.php"; if (isset($_POST) && $_POST != "") { //print_r($_POST); $bd = new BD(); $table = "parceiros"; if ($_POST['id'] == 0) { $dados['ativo'] = "true"; $bd->insert($table, $dados); $_POST['id'] = $bd->get("insert_id"); } $dados = $_POST; $dados['admin'] = isset($_POST['admin']) ? 'true' : 'false'; unset($dados['id']); $where = "codigo={$_POST['id']}"; $bd->update($table, $dados, $where); $bd->record_log("log_login", 'update_parceiros', $_POST['id']); header('Location: ../pages/parceiros.php'); }
<?php /** * Created by PhpStorm. * User: rodrigo.martins * Date: 19/01/2016 * Time: 10:20 */ include_once "first_all.php"; $bd = new BD(); $sql = "UPDATE produto_midia SET deletado='true' WHERE codigo=" . $_GET['codigo']; $bd->query($sql, true); $bd->getResult(); $bd->record_log("log_login", 'delete_arquivo_pdf', $_GET['codigo']);
<?php /** * Created by PhpStorm. * User: rodrigo.martins * Date: 21/01/2016 * Time: 10:47 */ include_once "first_all.php"; if (isset($_POST) && $_POST != "") { $bd = new BD(); $bd->start_transaction(); $table = "veiculos"; if ($_POST['id'] == 0) { $dados['ativo'] = "true"; $bd->insert($table, $dados); $_POST['id'] = $bd->get("insert_id"); } $dados = $_POST; unset($dados['id']); $dados['nome'] = "'" . $dados['nome'] . "'"; $where = "codigo={$_POST['id']}"; $bd->update($table, $dados, $where); $bd->record_log("log_login", 'update_veiculo', $_POST['id']); $bd->commit(); header('Location: ../pages/geral.php'); }
$dados_2 = array("valor" => $_POST[$k]); $where_2 = "codigo =" . str_replace("data_valor_", "", $k); $bd->update($table_1, $dados_2, $where_2); } } $dados = $_POST; unset($dados['id']); foreach (array_keys($_POST) as $k) { if (preg_match('/^data_baixa_/', $k)) { unset($dados[$k]); } if (preg_match('/^data_vencimento_/', $k)) { unset($dados[$k]); } if (preg_match('/^data_descricao_/', $k)) { unset($dados[$k]); } if (preg_match('/^data_valor_/', $k)) { unset($dados[$k]); } } if (!isset($dados['contrato_validado'])) { $dados['contrato_validado'] = 'off'; } $where = "codigo={$_POST['id']}"; $bd->update($table, $dados, $where); $bd->record_log("log_login", 'update_cadastro', $_POST['id']); header('Location: ../pages/detalhe_contrato.php?codigo=' . $_POST['id']); } else { echo "Ops...algo saiu errado!"; }
<?php /** * Created by PhpStorm. * User: rodrigo.martins * Date: 22/01/2016 * Time: 16:57 */ include_once "first_all.php"; $bd = new BD(); $bd->start_transaction(); $table = "usuarios"; $dados = array(); $dados['ativo'] = "\"false\""; $where = "codigo=" . $_GET['codigo']; $bd->update($table, $dados, $where); $bd->record_log("log_login", 'delete_usuario', $_GET['codigo']); $bd->commit(); header('Location: ../pages/usuarios.php');
<?php /** * Created by PhpStorm. * User: rodrigo.martins * Date: 22/01/2016 * Time: 16:57 */ include_once "first_all.php"; $bd = new BD(); $bd->start_transaction(); $table = "produtos"; $dados = array(); $dados['ativo'] = "\"false\""; $where = "codigo=" . $_GET['codigo']; $bd->update($table, $dados, $where); $bd->record_log("log_login", 'delete_produto', $_GET['codigo']); $bd->commit(); header('Location: ../pages/produtos.php');
<?php /** * Created by PhpStorm. * User: rodrigo.martins * Date: 21/01/2016 * Time: 10:47 */ include_once "first_all.php"; if (isset($_POST) && $_POST != "") { $bd = new BD(); $bd->start_transaction(); $table = "fabricantes"; if ($_POST['id'] == 0) { $dados['ativo'] = "true"; $bd->insert($table, $dados); $_POST['id'] = $bd->get("insert_id"); } $dados = $_POST; unset($dados['id']); $dados['nome'] = "'" . $dados['nome'] . "'"; $where = "codigo={$_POST['id']}"; $bd->update($table, $dados, $where); $bd->record_log("log_login", 'update_fabricante', $_POST['id']); $bd->commit(); header('Location: ../pages/geral.php'); }
<?php /** * Created by PhpStorm. * User: rodrigo.martins * Date: 22/01/2016 * Time: 16:57 */ include_once "first_all.php"; $bd = new BD(); $table = "clientes"; $dados['ativo'] = "\"false\""; $where = "codigo=" . $_GET['codigo']; $bd->update($table, $dados, $where); $bd->record_log("log_login", 'delete_cliente', $_GET['codigo']); header('Location: ../pages/clientes.php');
<?php /** * Created by PhpStorm. * User: rodrigo.martins * Date: 22/01/2016 * Time: 16:57 */ include_once "first_all.php"; $bd = new BD(); $bd->start_transaction(); $table = "representantes"; $dados = array(); $dados['ativo'] = "\"false\""; $where = "codigo=" . $_GET['codigo']; $bd->update($table, $dados, $where); $bd->record_log("log_login", 'delete_representante', $_GET['codigo']); $bd->commit(); header('Location: ../pages/parceiros.php');
if (file_exists($target_file)) { echo "Desculpe, esse arquivo já existe."; $uploadOk = 0; } // Allow certain file formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "jpe" && $imageFileType != "gif") { echo "Desculpe, somente arquivos JPG PNG JPEG e GIF são permitidos."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Desculpe, não foi possível subir seus arquivos."; exit; // if everything is ok, try to upload file } else { if (move_uploaded_file($_FILES[$nome_input]["tmp_name"], $target_file)) { //INSERT - produto_midia (downloads) $table4 = "representantes"; $dados4 = array("logo" => "'" . $target_file . "'"); $where4 = "codigo={$_POST['id']}"; $bd->update($table4, $dados4, $where4); } else { echo "Desculpe, ocorreu algum erro durante o uploading do seu arquivo."; exit; } } } $bd->record_log("log_login", 'update_representante', $_POST['id']); $bd->commit(); header('Location: ../pages/parceiros.php'); }
<?php /** * Created by PhpStorm. * User: rodrigo.martins * Date: 21/01/2016 * Time: 10:47 */ include_once "first_all.php"; if (isset($_POST) && $_POST != "") { $bd = new BD(); $bd->start_transaction(); $table = "usuarios"; if ($_POST['id'] == 0) { $dados['ativo'] = "true"; $bd->insert($table, $dados); $_POST['id'] = $bd->get("insert_id"); } $dados = $_POST; unset($dados['id']); $dados['admin'] = $dados['admin'] == 'on' ? 'true' : 'false'; foreach ($dados as $key => $campo) { $dados[$key] = "'" . $campo . "'"; } $where = "codigo={$_POST['id']}"; $bd->update($table, $dados, $where); $bd->record_log("log_login", 'update_usuarios', $_POST['id']); $bd->commit(); header('Location: ../pages/usuarios.php'); }
<?php /** * Created by PhpStorm. * User: rodrigo.martins * Date: 22/01/2016 * Time: 16:57 */ include_once "first_all.php"; $bd = new BD(); $bd->start_transaction(); $table = "aplicacao"; $dados = array(); $dados['ativo'] = "\"false\""; $where = "codigo=" . $_GET['codigo']; $bd->update($table, $dados, $where); $bd->record_log("log_login", 'delete_aplicacao', $_GET['codigo']); $bd->commit(); header('Location: ../pages/geral.php');
<?php /** * Created by PhpStorm. * User: rodrigo.martins * Date: 21/01/2016 * Time: 10:47 */ include_once "first_all.php"; if (isset($_POST) && $_POST != "") { $bd = new BD(); $table = "clientes"; //print_r($_SESSION); if ($_POST['id'] == 0) { $dados['ativo'] = "true"; $dados['cod_parceiro'] = $_SESSION['codigo']; $bd->insert($table, $dados); $_POST['id'] = $bd->get("insert_id"); } $dados = $_POST; unset($dados['id']); $where = "codigo={$_POST['id']}"; $bd->update($table, $dados, $where); $bd->record_log("log_login", 'update_clientes', $_POST['id']); if (isset($_GET['r'])) { header('Location: ../pages/detalhe_contrato.php?codigo=0'); } else { header('Location: ../pages/clientes.php'); } }
<?php require_once "../backend/first_all.php"; $bd = new BD(); //Caso o usuário não tenha o perfil de administrador if ($_SESSION['admin'] != 'true') { session_start(); session_destroy(); $bd->record_log("log_login", 'acesso aos usuários sem permissão'); header('Location: login.php'); } ?> <!DOCTYPE html> <html lang="pt-BR"> <?php include_once "head.php"; ?> <body> <div id="wrapper"> <?php include_once "nav.php"; ?> <div id="page-wrapper"> <br> <div class="row"> <div class="panel panel-primary">
<?php /** * Created by PhpStorm. * User: rodrigo.martins * Date: 22/01/2016 * Time: 16:57 */ include_once "first_all.php"; $bd = new BD(); $bd->start_transaction(); $table = "fabricantes"; $dados = array(); $dados['ativo'] = "\"false\""; $where = "codigo=" . $_GET['codigo']; $bd->update($table, $dados, $where); $bd->record_log("log_login", 'delete_fabricante', $_GET['codigo']); $bd->commit(); header('Location: ../pages/geral.php');