Commit 3d84d113610bcb5c4ea1813ad6e124eb087c2037

Authored by Leandro Arndt
1 parent 8d5287f1
Exists in mysqli

Classe DB

restrito/sis_grupo/grupoperm.php
... ... @@ -8,14 +8,16 @@
8 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 13 include "../inc/autenticar.php";
12 14  
13 15 checkPerm("CHPERM");
14 16  
15 17 if ($_GET["idgrupo"] and !$_POST["updt"]) {
16 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 22 $query = "select a.idacao,
21 23 a.denominacao,
... ... @@ -34,7 +36,7 @@ if ($_GET["idgrupo"] and !$_POST["updt"]) {
34 36 and m.ativo = 1
35 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 42 <style>
... ... @@ -85,7 +87,7 @@ if ($_GET[&quot;idgrupo&quot;] and !$_POST[&quot;updt&quot;]) {
85 87 $tela = "";
86 88 $cont = 0;
87 89 $contAcao = 0;
88   - while($row = mysql_fetch_array($rs)){
  90 + while($row = mysqli_fetch_array($rs)){
89 91  
90 92 if($cont>0){
91 93 if($menu <> $row['idmenu']){
... ...
restrito/sis_grupo/index.php
... ... @@ -15,8 +15,8 @@ include &quot;../inc/paginacaoIni.php&quot;;
15 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 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 45 </tr>
46 46 <?php
47 47 $cor = false;
48   - while($registro = mysql_fetch_array($rs)){
  48 + while($registro = mysqli_fetch_array($rs)){
49 49 $click = "edita('".$registro["idgrupo"]."','".$registro["nome"]."','".$registro["descricao"]."','".$registro["idsecretaria"]."','".$registro["ativo"]."')";
50 50  
51 51 if($cor)
... ...
restrito/sis_grupo/manutencao.php
... ... @@ -35,11 +35,11 @@
35 35  
36 36 //verifica se ja existe registro cadastrado com a informaçao passada ---
37 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 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 44 $erro = "Nome do perfil já existe no cadastro.";
45 45 return false;
... ...
restrito/sis_grupo/manutencaousuarios.php
... ... @@ -55,7 +55,7 @@
55 55 if(validaDados())
56 56 {
57 57  
58   - $con = db_open_trans();
  58 + $con = DB::conn();
59 59 $all_query_ok=true;
60 60  
61 61 $sql = "delete from sis_grupousuario where idgrupo = $idgrupo";
... ... @@ -69,13 +69,13 @@
69 69 {
70 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 75 $idusuario = $row['idusuario'];
76 76  
77 77 $sql = "insert into sis_grupousuario (idgrupo, idusuario)
78   - values ('$idgrupo', $idusuario)";
  78 + values ('".DB::esc($idgrupo)."', ".DB::esc($idusuario).")";
79 79  
80 80 if (!$con->query($sql))
81 81 {
... ... @@ -100,16 +100,16 @@
100 100 header("Location: index.php");
101 101 }
102 102  
103   - $con->close();
  103 + // $con->close();
104 104  
105 105 }
106 106 }
107 107 else
108 108 {
109   - $idgrupo = $_GET["idgrupo"];
  109 + $idgrupo = DB::esc($_GET["idgrupo"]);
110 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 114 $nomegrupo = $row["nome"];
115 115  
... ... @@ -117,8 +117,8 @@
117 117 where gu.idusuario = u.idusuario and gu.idgrupo = $idgrupo";
118 118  
119 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 123 $selecionados[$i] = $registro['login'];
124 124 $i++;
... ...
restrito/sis_grupo/usuarios.php
... ... @@ -101,9 +101,9 @@
101 101 <?php
102 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 107 if(!estaSelecionado($row['login']))
108 108 {
109 109 ?><option value="<?php echo $row['login']; ?>" ><?php echo $row['login']; ?></option><?php
... ...