| Server IP : 20.75.53.88 / Your IP : 216.73.217.72 [ Web Server : Apache System : Linux VMRALP-3 4.4.0-256-generic #290~14.04.1-Ubuntu SMP Thu Jun 20 09:24:50 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29+esm15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Domains : 3 Domains MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/merenda/mnovaajuste2019/modulos/escola/ |
Upload File : |
<?php
/**
* Created by PhpStorm.
* User: Ralp Alves
* Date: 05/03/15
* Time: 08:31
*/
session_start();
$idusu = $_SESSION['idusu'];
include_once('includes/funcoes.php');
$var_acao = $_GET['var_acao'];
mysql_select_db($banco, $conexao);
//INCLUSAO DE REGISTROS
if ($var_acao=='cadastrar') {
$v_inep = strtoupper($_POST['txt_inep']);
$v_esco = sem_acento(strtoupper($_POST['txt_escola']));
$v_dist = $_POST['txt_distrito'];
$v_qalu = $_POST['txt_qtd_alunos'];
$v_ufes = sem_acento(strtoupper($_POST['txt_uf']));
$v_muni = sem_acento(strtoupper($_POST['txt_municipio']));
$v_ende = sem_acento(strtoupper($_POST['txt_endereco']));
$v_bair = sem_acento(strtoupper($_POST['txt_bairro']));
$v_cepe = $_POST['txt_cep'];
$v_tele = $_POST['txt_telefone'];
$v_rota = $_POST['txt_rota'];
$v_dire = sem_acento(strtoupper($_POST['txt_diretor']));
$v_tdir = $_POST['txt_tel_diretor'];
$v_mdir = strtolower($_POST['txt_mail_diretor']);
$v_cred = strtoupper($_POST['txt_crede']);
$gravar = mysql_query("insert into
escolas
(
esc_inep, esc_dis_id, esc_nome, esc_qtdalu_mat, esc_bairro, esc_uf, esc_municipio, esc_cep, esc_telefone, esc_crede, esc_rota_id, esc_diretor, esc_diretor_tel,
esc_diretor_email, esc_endereco
)
value
(
'$v_inep', '$v_dist', '$v_esco', '$v_qalu' ,'$v_bair' ,'$v_ufes' ,'$v_muni' ,'$v_cepe' ,'$v_tele', '$v_cred', '$v_rota', '$v_dire', '$v_tdir',
'$v_mdir', '$v_ende'
)");
//PEGA ULTIMO ID CADASTRADO
$ult_cod = mysql_insert_id();
//********LOG USUARIOS*******/
$datal = date('d/m/Y');
$horal = date('H:i');
$ipnum = $_SERVER['REMOTE_ADDR'];
$log = mysql_query("INSERT INTO usuariolog
(
log_usu_id,log_data,log_hora,log_acao,log_ip
)
VALUES
(
'$idusu','$datal','$horal','incluiu a escola $v_esco','$ipnum'
)") or die('Erro ao gravar log: ' . mysql_error());
//********LOG USUARIOS*******/
//passa os dados cadastrados através de um array
$array['v'] = $v_inep;
$array['inepe'] = $v_inep;
$array['crede'] = $v_cred;
$array['escola'] = $v_esco;
$array['distri'] = $v_dist;
$array['qaluno'] = $v_qalu;
$array['ufesco'] = $v_ufes;
$array['munici'] = $v_muni;
$array['endere'] = $v_ende;
$array['bairro'] = $v_bair;
$array['cepesc'] = $v_cepe;
$array['telefo'] = $v_tele;
$array['rotaes'] = $v_rota;
$array['direto'] = $v_dire;
$array['emaild'] = $v_mdir;
$array['teledi'] = $v_tdir;
$dados = http_build_query($array);
$a = new aviso();
$a->avisoSucesso('?page=./escola/escola_edt&cod_escola=' . $ult_cod . '&v=' . $dados, 'Registro ' . $ult_cod . ' processado com sucesso', 'processar registro');
// $a->avisoSucesso('?page=./escola/escola_cad', 'Registro ' . $ult_cod . ' processado com sucesso', 'processar registro');
}
//EDIÇÃO DE REGISTROS
if ($var_acao=='editar') {
$v_codi = $_POST['txt_ID'];
$v_inep = $_POST['txt_inep'];
$v_esco = sem_acento(strtoupper($_POST['txt_escola']));
$v_dist = $_POST['txt_distrito'];
$v_qalu = $_POST['txt_qtd_alunos'];
$v_ufes = sem_acento(strtoupper($_POST['txt_uf']));
$v_muni = sem_acento(strtoupper($_POST['txt_municipio']));
$v_ende = sem_acento(strtoupper($_POST['txt_endereco']));
$v_bair = sem_acento(strtoupper($_POST['txt_bairro']));
$v_cepe = $_POST['txt_cep'];
$v_tele = $_POST['txt_telefone'];
$v_rota = $_POST['txt_rota'];
$v_dire = sem_acento(strtoupper($_POST['txt_diretor']));
$v_tdir = $_POST['txt_tel_diretor'];
$v_mdir = $_POST['txt_mail_diretor'];
$v_cred = $_POST['txt_crede'];
$editar = mysql_query("
update
escolas set
esc_inep='$v_inep', esc_dis_id='$v_dist', esc_nome='$v_esco', esc_qtdalu_mat='$v_qalu', esc_bairro='$v_bair', esc_uf='$v_ufes',
esc_municipio='$v_muni', esc_cep='$v_cepe', esc_telefone='$v_tele', esc_crede='$v_cred', esc_rota_id='$v_rota', esc_diretor='$v_dire',
esc_diretor_tel='$v_tdir', esc_diretor_email='$v_mdir', esc_endereco='$v_ende'
where esc_id = $v_codi;");
//********LOG USUARIOS*******/
$datal = date('d/m/Y');
$horal = date('H:i');
$ipnum = $_SERVER['REMOTE_ADDR'];
$log = mysql_query("INSERT INTO usuariolog
(
log_usu_id,log_data,log_hora,log_acao,log_ip
)
VALUES
(
'$idusu','$datal','$horal','editou a escola $v_esco','$ipnum'
)") or die('Erro ao gravar log: ' . mysql_error());
//********LOG USUARIOS*******/
$a = new aviso();
$a->avisoSucesso('?page=./escola/escola', 'Registro alterado com sucesso', 'Edição');
}
//EXCLUSAO DE REGISTROS
if ($var_acao=='excluir') {
$cod_esc = &$_GET['cod_escola'];
$editar = mysql_query("delete from escolas where esc_id = $cod_esc;") or die('
<div class="container">
<div id= "dialog" class="modal modal-dialog" ></div >
<div class="alert alert-danger" style="text-align: center;">
<a href="?page=./escola/escola" class="close" data-dismiss="alert"><i class="fa fa-check" title="salvar"></i></a>
<strong>Registro não pode ser excluído!</strong><br><br> <strong>Verifique a mensagem abaixo:</strong>(escola_crud_php #126) <br>' . mysql_error() . '
</div>
</div>
</div>
');
//********LOG USUARIOS*******/
$datal = date('d/m/Y');
$horal = date('H:i');
$ipnum = $_SERVER['REMOTE_ADDR'];
$log = mysql_query("INSERT INTO usuariolog
(
log_usu_id,log_data,log_hora,log_acao,log_ip
)
VALUES
(
'$idusu','$datal','$horal','Excluiu a escola $cod_esc','$ipnum'
)") or die('Erro ao gravar log: ' . mysql_error());
//********LOG USUARIOS*******/
echo("
<div class='container' style = 'text-align: center;' >
<div id = 'dialog' class='modal modal-dialog' ></div >
<div class='bs-example' >
<div class='alert alert-success' >
<a href = '?page=./escola/escola' class='close' data-dismiss = 'alert' ><i class='fa fa-check' title='salvar'></i></a>
Escola <strong>'$cod_esc' </strong > excluída com sucesso!
</div>
</div>
</div>
</div>
");
}