Commit 3d84d113610bcb5c4ea1813ad6e124eb087c2037
1 parent
8d5287f1
Exists in
mysqli
Classe DB
Showing
5 changed files
with
25 additions
and
23 deletions
Show diff stats
restrito/sis_grupo/grupoperm.php
@@ -8,14 +8,16 @@ | @@ -8,14 +8,16 @@ | ||
8 | modificá-lo sob os termos da Licença GPL2. | 8 | modificá-lo sob os termos da Licença GPL2. |
9 | ***********************************************************************************/ | 9 | ***********************************************************************************/ |
10 | 10 | ||
11 | +include_once("../inc/config.php"); | ||
12 | +include_once(DIR_CLASSES_LEIACESSO."/db.class.php"); | ||
11 | include "../inc/autenticar.php"; | 13 | include "../inc/autenticar.php"; |
12 | 14 | ||
13 | checkPerm("CHPERM"); | 15 | checkPerm("CHPERM"); |
14 | 16 | ||
15 | if ($_GET["idgrupo"] and !$_POST["updt"]) { | 17 | if ($_GET["idgrupo"] and !$_POST["updt"]) { |
16 | include "../inc/topo.php"; | 18 | include "../inc/topo.php"; |
17 | - $idgrupo = $_GET["idgrupo"]; | ||
18 | - $nomegrupo = $_GET["nomegrupo"]; | 19 | + $idgrupo = DB::esc($_GET["idgrupo"]); |
20 | + $nomegrupo = DB::esc($_GET["nomegrupo"]); | ||
19 | 21 | ||
20 | $query = "select a.idacao, | 22 | $query = "select a.idacao, |
21 | a.denominacao, | 23 | a.denominacao, |
@@ -34,7 +36,7 @@ if ($_GET["idgrupo"] and !$_POST["updt"]) { | @@ -34,7 +36,7 @@ if ($_GET["idgrupo"] and !$_POST["updt"]) { | ||
34 | and m.ativo = 1 | 36 | and m.ativo = 1 |
35 | order by m.idmenu, t.idtela, a.denominacao"; | 37 | order by m.idmenu, t.idtela, a.denominacao"; |
36 | 38 | ||
37 | - $rs = execQuery($query); | 39 | + $rs = DB::execQuery($query); |
38 | 40 | ||
39 | ?> | 41 | ?> |
40 | <style> | 42 | <style> |
@@ -85,7 +87,7 @@ if ($_GET["idgrupo"] and !$_POST["updt"]) { | @@ -85,7 +87,7 @@ if ($_GET["idgrupo"] and !$_POST["updt"]) { | ||
85 | $tela = ""; | 87 | $tela = ""; |
86 | $cont = 0; | 88 | $cont = 0; |
87 | $contAcao = 0; | 89 | $contAcao = 0; |
88 | - while($row = mysql_fetch_array($rs)){ | 90 | + while($row = mysqli_fetch_array($rs)){ |
89 | 91 | ||
90 | if($cont>0){ | 92 | if($cont>0){ |
91 | if($menu <> $row['idmenu']){ | 93 | if($menu <> $row['idmenu']){ |
restrito/sis_grupo/index.php
@@ -15,8 +15,8 @@ include "../inc/paginacaoIni.php"; | @@ -15,8 +15,8 @@ include "../inc/paginacaoIni.php"; | ||
15 | $filtro = ""; | 15 | $filtro = ""; |
16 | 16 | ||
17 | 17 | ||
18 | -if(!empty($nome)) $filtro .= " and sis_grupo.nome like '%$nome%' "; | ||
19 | -if(!empty($descricao)) $filtro .= " and sis_grupo.descricao like '%$descricao%' "; | 18 | +if(!empty($nome)) $filtro .= " and sis_grupo.nome like '%".DB::esc($nome)."%' "; |
19 | +if(!empty($descricao)) $filtro .= " and sis_grupo.descricao like '%".DB:esc($descricao)."%' "; | ||
20 | if(!empty($ativo)) $filtro .= " and sis_grupo.ativo = ".(($ativo=="2")?"0":"1")." "; | 20 | if(!empty($ativo)) $filtro .= " and sis_grupo.ativo = ".(($ativo=="2")?"0":"1")." "; |
21 | 21 | ||
22 | 22 | ||
@@ -45,7 +45,7 @@ $rs = execQueryPag($sql); | @@ -45,7 +45,7 @@ $rs = execQueryPag($sql); | ||
45 | </tr> | 45 | </tr> |
46 | <?php | 46 | <?php |
47 | $cor = false; | 47 | $cor = false; |
48 | - while($registro = mysql_fetch_array($rs)){ | 48 | + while($registro = mysqli_fetch_array($rs)){ |
49 | $click = "edita('".$registro["idgrupo"]."','".$registro["nome"]."','".$registro["descricao"]."','".$registro["idsecretaria"]."','".$registro["ativo"]."')"; | 49 | $click = "edita('".$registro["idgrupo"]."','".$registro["nome"]."','".$registro["descricao"]."','".$registro["idsecretaria"]."','".$registro["ativo"]."')"; |
50 | 50 | ||
51 | if($cor) | 51 | if($cor) |
restrito/sis_grupo/manutencao.php
@@ -35,11 +35,11 @@ | @@ -35,11 +35,11 @@ | ||
35 | 35 | ||
36 | //verifica se ja existe registro cadastrado com a informaçao passada --- | 36 | //verifica se ja existe registro cadastrado com a informaçao passada --- |
37 | if ($acao=="Incluir") | 37 | if ($acao=="Incluir") |
38 | - $sql = "select * from sis_grupo where nome = '$nome'"; | 38 | + $sql = "select * from sis_grupo where nome = '".DB::esc($nome)."'"; |
39 | else | 39 | else |
40 | - $sql = "select * from sis_grupo where nome = '$nome' and idgrupo <> $idgrupo"; | 40 | + $sql = "select * from sis_grupo where nome = '".DB::esc($nome)."' and idgrupo <> ".DB::esc($idgrupo); |
41 | 41 | ||
42 | - if(mysql_num_rows(execQuery($sql)) > 0) | 42 | + if(mysqli_num_rows(DB::execQuery($sql)) > 0) |
43 | { | 43 | { |
44 | $erro = "Nome do perfil já existe no cadastro."; | 44 | $erro = "Nome do perfil já existe no cadastro."; |
45 | return false; | 45 | return false; |
restrito/sis_grupo/manutencaousuarios.php
@@ -55,7 +55,7 @@ | @@ -55,7 +55,7 @@ | ||
55 | if(validaDados()) | 55 | if(validaDados()) |
56 | { | 56 | { |
57 | 57 | ||
58 | - $con = db_open_trans(); | 58 | + $con = DB::conn(); |
59 | $all_query_ok=true; | 59 | $all_query_ok=true; |
60 | 60 | ||
61 | $sql = "delete from sis_grupousuario where idgrupo = $idgrupo"; | 61 | $sql = "delete from sis_grupousuario where idgrupo = $idgrupo"; |
@@ -69,13 +69,13 @@ | @@ -69,13 +69,13 @@ | ||
69 | { | 69 | { |
70 | foreach ($selecionados as $usr) | 70 | foreach ($selecionados as $usr) |
71 | { | 71 | { |
72 | - $sql = "select idusuario from sis_usuario where login = '$usr'"; | ||
73 | - $rs = execQuery($sql); | ||
74 | - $row = mysql_fetch_array($rs); | 72 | + $sql = "select idusuario from sis_usuario where login = '".DB::esc($usr)."'"; |
73 | + $rs = DB::execQuery($sql); | ||
74 | + $row = mysqli_fetch_array($rs); | ||
75 | $idusuario = $row['idusuario']; | 75 | $idusuario = $row['idusuario']; |
76 | 76 | ||
77 | $sql = "insert into sis_grupousuario (idgrupo, idusuario) | 77 | $sql = "insert into sis_grupousuario (idgrupo, idusuario) |
78 | - values ('$idgrupo', $idusuario)"; | 78 | + values ('".DB::esc($idgrupo)."', ".DB::esc($idusuario).")"; |
79 | 79 | ||
80 | if (!$con->query($sql)) | 80 | if (!$con->query($sql)) |
81 | { | 81 | { |
@@ -100,16 +100,16 @@ | @@ -100,16 +100,16 @@ | ||
100 | header("Location: index.php"); | 100 | header("Location: index.php"); |
101 | } | 101 | } |
102 | 102 | ||
103 | - $con->close(); | 103 | + // $con->close(); |
104 | 104 | ||
105 | } | 105 | } |
106 | } | 106 | } |
107 | else | 107 | else |
108 | { | 108 | { |
109 | - $idgrupo = $_GET["idgrupo"]; | 109 | + $idgrupo = DB::esc($_GET["idgrupo"]); |
110 | $sql = "select nome from sis_grupo where idgrupo = $idgrupo"; | 110 | $sql = "select nome from sis_grupo where idgrupo = $idgrupo"; |
111 | - $result = execQuery($sql); | ||
112 | - $row = mysql_fetch_array($result); | 111 | + $result = DB::execQuery($sql); |
112 | + $row = mysqli_fetch_array($result); | ||
113 | 113 | ||
114 | $nomegrupo = $row["nome"]; | 114 | $nomegrupo = $row["nome"]; |
115 | 115 | ||
@@ -117,8 +117,8 @@ | @@ -117,8 +117,8 @@ | ||
117 | where gu.idusuario = u.idusuario and gu.idgrupo = $idgrupo"; | 117 | where gu.idusuario = u.idusuario and gu.idgrupo = $idgrupo"; |
118 | 118 | ||
119 | $i=0; | 119 | $i=0; |
120 | - $resultado = execQuery($sql); | ||
121 | - while($registro = mysql_fetch_array($resultado)) | 120 | + $resultado = DB::execQuery($sql); |
121 | + while($registro = mysqli_fetch_array($resultado)) | ||
122 | { | 122 | { |
123 | $selecionados[$i] = $registro['login']; | 123 | $selecionados[$i] = $registro['login']; |
124 | $i++; | 124 | $i++; |
restrito/sis_grupo/usuarios.php
@@ -101,9 +101,9 @@ | @@ -101,9 +101,9 @@ | ||
101 | <?php | 101 | <?php |
102 | $sql="select login from sis_usuario u where status = 'A' order by login"; | 102 | $sql="select login from sis_usuario u where status = 'A' order by login"; |
103 | 103 | ||
104 | - $rs = execQuery($sql); | 104 | + $rs = DB::execQuery($sql); |
105 | 105 | ||
106 | - while ($row = mysql_fetch_array($rs)) { | 106 | + while ($row = mysqli_fetch_array($rs)) { |
107 | if(!estaSelecionado($row['login'])) | 107 | if(!estaSelecionado($row['login'])) |
108 | { | 108 | { |
109 | ?><option value="<?php echo $row['login']; ?>" ><?php echo $row['login']; ?></option><?php | 109 | ?><option value="<?php echo $row['login']; ?>" ><?php echo $row['login']; ?></option><?php |