Changeset 257 for trunk/admin/modules/Elezioni/ele_permessi.php
- Timestamp:
- Feb 9, 2019, 8:45:24 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/ele_permessi.php
r2 r257 19 19 $perms=ChiSei($id_cons_gen); 20 20 if ($perms<64 or !$id_cons_gen) die("Non hai i permessi per inserire dati ($perms)($id_cons_gen), o non hai scelto la consultazione!"); 21 $res = mysql_query("SELECT t1.tipo_cons,t2.id_cons FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune'" , $dbi); 22 list($tipo_cons,$id_cons) = mysql_fetch_row($res); 21 $sql="SELECT t1.tipo_cons,t2.id_cons FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune'"; 22 $res = $dbi->prepare("$sql"); 23 $res->execute(); 24 list($tipo_cons,$id_cons) = $res->fetch(PDO::FETCH_NUM); 23 25 if (isset($param['aid2'])) get_magic_quotes_gpc() ? $aid2=$param['aid2']:$aid2=addslashes($param['aid2']); else $aid2=''; 24 26 if (isset($param['id_sede'])) $id_sede=intval($param['id_sede']); else $id_sede=''; … … 45 47 } 46 48 OpenTable(); 47 $resmod = mysql_query("SELECT * FROM ".$prefix."_ele_operatori where id_cons=$id_cons and permessi<64 order by aid", $dbi); 49 $sql="SELECT * FROM ".$prefix."_ele_operatori where id_cons=$id_cons and permessi<64 order by aid"; 50 $resmod = $dbi->prepare("$sql"); 51 $resmod->execute(); 48 52 49 53 echo "<br><table><tr align=\"center\" bgcolor=\"$bgcolor1\">"; … … 55 59 56 60 57 $restmp = mysql_query("SELECT aid FROM ".$prefix."_ele_operatori where id_cons=$id_cons and permessi<64 order by aid", $dbi); 61 $sql="SELECT aid FROM ".$prefix."_ele_operatori where id_cons=$id_cons and permessi<64 order by aid"; 62 $restmp = $dbi->prepare("$sql"); 63 $restmp->execute(); 58 64 if($restmp) { 59 65 $listmp='';$virg=''; 60 while (list($artmp) = mysql_fetch_row($restmp)){ //elenco degli operatori gia' autorizzati66 while (list($artmp) = $restmp->fetch(PDO::FETCH_NUM)){ //elenco degli operatori gia' autorizzati 61 67 $listmp .= $virg."'".$artmp."'"; 62 68 $virg=','; … … 65 71 66 72 if (!$listmp) $listmp="''"; 67 $resins = mysql_query("select aid from ".$prefix."_authors where id_comune=$id_comune and (admincomune=1 and aid not in ($listmp)) order by aid",$dbi); // operatori registrati ma non ancora autorizzati 73 $sql="select aid from ".$prefix."_authors where id_comune=$id_comune and (admincomune=1 and aid not in ($listmp)) order by aid"; // operatori registrati ma non ancora autorizzati 74 $resins = $dbi->prepare("$sql"); 75 $resins->execute(); 68 76 69 77 … … 73 81 echo "<td><select name=\"aid2\">"; 74 82 echo "<option value=\"\">"; 75 if($resins ) {76 while(list($utente)= mysql_fetch_row($resins)){83 if($resins->rowCount()) { 84 while(list($utente)=$resins->fetch(PDO::FETCH_NUM)){ 77 85 echo "<option value=\"$utente\">$utente"; 78 86 } 79 87 } 80 88 echo "</select></td>"; 81 $ressede = mysql_query("SELECT id_sede, indirizzo from ".$prefix."_ele_sede where id_cons=$id_cons", $dbi); 89 $ressede = mysql_query("SELECT id_sede, indirizzo from ".$prefix."_ele_sede where id_cons=$id_cons"; 90 $ressede = $dbi->prepare("$sql"); 91 $ressede->execute(); 82 92 echo "<td><select name=\"id_sede\">"; 83 93 echo "<option value=\"0\"> "._TUTTESEDI; 84 if($ressede )85 while(list($id,$descr)= mysql_fetch_row($ressede)){94 if($ressede->rowCount()) 95 while(list($id,$descr)=$ressede->fetch(PDO::FETCH_NUM)){ 86 96 $sel= ($id == $id_sede) ? "selected":""; 87 97 $arr[$id]=$descr; … … 103 113 echo "<td><input type=\"submit\" name=\"add\" value=\""._AGGIUNGI."\"></td></tr></form></table>"; 104 114 echo "<br><hr><br><table>"; 105 if($resmod ){115 if($resmod->rowCount()){ 106 116 $i=1; 107 while (list($id_cons2,$id_sede2,$id_comunetemp,$perm,$utente) = mysql_fetch_row($resmod)){117 while (list($id_cons2,$id_sede2,$id_comunetemp,$perm,$utente) = $resmod->fetch(PDO::FETCH_NUM)){ 108 118 $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; 109 119 echo "<form name=\"modello$i\" action=\"admin.php\">" … … 115 125 echo "<tr align=\"center\" bgcolor=\"$bgcolor1\">"; 116 126 echo "<td align=\"center\" width=\"32\"><b>$utente</b></td>"; 117 $ressede = mysql_query("SELECT id_sede, indirizzo from ".$prefix."_ele_sede where id_cons=$id_cons", $dbi); 127 $sql="SELECT id_sede, indirizzo from ".$prefix."_ele_sede where id_cons=$id_cons"; 128 $ressede = $dbi->prepare("$sql"); 129 $ressede->execute(); 118 130 echo "<td><select name=\"id_sede\">"; 119 131 echo "<option value=\"0\"> "._TUTTESEDI; 120 while(list($id,$descr)= mysql_fetch_row($ressede)){132 while(list($id,$descr)=$ressede->fetch(PDO::FETCH_NUM)){ 121 133 $sel= ($id == $id_sede2) ? "selected":""; 122 134 $arr[$id]=$descr; … … 147 159 if ($perms>32 and $permessi<$perms and $aid2) { 148 160 if ($do == "autorizza") { 149 $result = mysql_query("insert into ".$prefix."_ele_operatori (id_cons,id_sede,id_comune,permessi,aid) values ('$id_cons','$id_sede','$id_comune','$permessi','$aid2')", $dbi)||die("Errore 1301: Non e' stato possibile inserire l'utente!".mysql_error()); 161 $sql="insert into ".$prefix."_ele_operatori (id_cons,id_sede,id_comune,permessi,aid) values ('$id_cons','$id_sede','$id_comune','$permessi','$aid2')"; 162 $res = $dbi->prepare("$sql"); 163 $res->execute(); 150 164 Header("Location: admin.php?op=permessi&id_cons_gen=$id_cons_gen"); 151 165 } elseif ($do == "update") { 152 $result = mysql_query("update ".$prefix."_ele_operatori set id_sede='$id_sede' , permessi='$permessi' where id_cons='$id_cons' and aid='$aid2' ", $dbi); 166 $sql="update ".$prefix."_ele_operatori set id_sede='$id_sede' , permessi='$permessi' where id_cons='$id_cons' and aid='$aid2' "; 167 $res = $dbi->prepare("$sql"); 168 $res->execute(); 153 169 if (!$result) return; 154 170 Header("Location: admin.php?op=permessi&id_cons_gen=$id_cons_gen");
Note:
See TracChangeset
for help on using the changeset viewer.