Changeset 257 for trunk/admin/modules/Elezioni/ele_operatori.php
- Timestamp:
- Feb 9, 2019, 8:45:24 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/ele_operatori.php
r53 r257 15 15 $perms=ChiSei($id_cons_gen); 16 16 if (($perms<64 or !$id_cons_gen) and $perms!=256) die("(($perms<64 or !$id_cons_gen) and $perms!=256)Non hai i permessi per inserire dati, o non hai scelto la consultazione!"); 17 $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); 18 list($tipo_cons,$id_cons) = mysql_fetch_row($res); 17 $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'"; 18 $res = $dbi->prepare("$sql"); 19 $res->execute(); 20 list($tipo_cons,$id_cons) = $res->fetch(PDO::FETCH_NUM); 19 21 if (isset($_GET['aid2'])) get_magic_quotes_gpc() ? $aid2=$param['aid2']:$aid2=addslashes($param['aid2']); else {if ($perms==256) $aid2='admin'; else $aid2='';} 20 22 if (isset($_GET['id_sede'])) $id_sede=intval($_GET['id_sede']); else $id_sede=''; … … 38 40 $id_comune=$_SESSION['id_comune']; 39 41 $user=$aid; 40 $rescom = mysql_query("select descrizione from ".$prefix."_ele_comuni where id_comune=$id_comune",$dbi); 41 list($descr_com) = mysql_fetch_row($rescom); 42 $resmod = mysql_query("SELECT aid,name,email FROM ".$prefix."_authors where aid='$aid2' and id_comune='$id_comune'", $dbi); 43 list ($aid2,$name,$email) = mysql_fetch_row($resmod); 42 $sql="select descrizione from ".$prefix."_ele_comuni where id_comune=$id_comune"; 43 $rescom = $dbi->prepare("$sql"); 44 $rescom->execute(); 45 list($descr_com) = $rescom->fetch(PDO::FETCH_NUM); 46 $sql="SELECT aid,name,email FROM ".$prefix."_authors where aid='$aid2' and id_comune='$id_comune'"; 47 $resmod = $dbi->prepare("$sql"); 48 $resmod->execute(); 49 list ($aid2,$name,$email) = $resmod->fetch(PDO::FETCH_NUM); 44 50 if (isset($_GET['mex'])){ 45 51 echo "<table align=\"center\"><tr><td style=\"background-color: rgb(255, 0, 0)\">"; … … 54 60 echo "<table style=\"color: #000000;\"><tr align=\"center\" bgcolor=\"$bgcolor1\">"; 55 61 echo "<td><b>"._UTENTE."</b></td>"; 56 $resins = mysql_query("select aid from ".$prefix."_authors where id_comune='$id_comune' order by aid",$dbi); 62 $sql="select aid from ".$prefix."_authors where id_comune='$id_comune' order by aid"; 63 $resins = $dbi->prepare("$sql"); 64 $resins->execute(); 57 65 echo "</tr><tr align=\"center\">"; 58 66 echo "<td><input type=\"hidden\" name=\"pag_op\" value=\"admin.php?op=operatori&id_cons_gen=$id_cons_gen&aid2=\">"; 59 67 echo "<select name=\"aid2\" onChange=\"top.location.href=this.form.pag_op.value+this.form.aid2.options[this.form.aid2.selectedIndex].value;return false\">"; 60 68 echo "<option value=\"\">"; 61 while(list($utente)= mysql_fetch_row($resins)){69 while(list($utente)=$resins->fetch(PDO::FETCH_NUM)){ 62 70 $sel= ($utente == $aid2) ? "selected":""; 63 71 echo "<option value=\"$utente\" $sel>$utente"; … … 66 74 echo "</select></td>"; 67 75 echo "</tr></table></form><br><hr>"; 68 $resmod = mysql_query("SELECT * FROM ".$prefix."_authors where id_cons='$id_cons' and id_comune='$id_comune'", $dbi); 76 # $sql="SELECT * FROM ".$prefix."_authors where id_cons='$id_cons' and id_comune='$id_comune'"; 77 # $resmod = $dbi->prepare("$sql"); 78 # $resmod->execute(); 69 79 echo "<form name=\"modello\" action=\"admin.php\">"; 70 80 echo "<table style=\"color: #000000;\">"; … … 111 121 if ($do == "add") { 112 122 $sql="select * from ".$prefix."_authors where aid='$aid2' and id_comune=$id_comune"; 113 $res=mysql_query($sql,$dbi); 114 $max=mysql_num_rows($res); 123 $res = $dbi->prepare("$sql"); 124 $res->execute(); 125 $max=$res->rowCount(); 115 126 if ($passwd==$passwd2 and $max==0){ 116 127 if ($aid2=='admin') $super='1,0,0,'; else $super = '0,1,0,'; 117 128 $sql="insert into ".$prefix."_authors (aid,name,id_comune,email,pwd,counter,adminop,admincomune,adminsuper,admlanguage) values ('$aid2','$name','$id_comune' , '$email','".md5($passwd)."',0,$super'$currentlang')"; 118 $result = mysql_query($sql, $dbi)||die("Errore 1301: Non e' stato possibile inserire l'utente!<br>$sql<br>".mysql_error()); 129 $res = $dbi->prepare("$sql"); 130 $res->execute(); 119 131 if ($perms==256 and $aid2=='admin'){ 120 $result = mysql_query("insert into ".$prefix."_ele_operatori (id_cons,id_sede,id_comune,permessi,aid) values ('0','0','$id_comune','64','$aid2')", $dbi) || die("<br><br>Errore di inserimento: ".mysql_error()); 132 $sql="insert into ".$prefix."_ele_operatori (id_cons,id_sede,id_comune,permessi,aid) values ('0','0','$id_comune','64','$aid2')"; 133 $res = $dbi->prepare("$sql"); 134 $res->execute(); 121 135 } 122 136 Header("Location: admin.php?op=operatori&id_cons_gen=$id_cons_gen"); … … 128 142 } 129 143 } elseif ($do == "update") { 130 $result = mysql_query("update ".$prefix."_authors set name='$name',pwd='".md5($passwd)."', email='$email' where id_comune='$id_comune' and aid='$aid2' ", $dbi); 144 $sql="update ".$prefix."_authors set name='$name',pwd='".md5($passwd)."', email='$email' where id_comune='$id_comune' and aid='$aid2' "; 145 $res = $dbi->prepare("$sql"); 146 $res->execute(); 131 147 if (!$result) return; 132 148 if ($aid2==$aid) $_SESSION['pwd']=md5($passwd);
Note:
See TracChangeset
for help on using the changeset viewer.