Index: trunk/admin/modules/Elezioni/ele_operatori.php
===================================================================
--- trunk/admin/modules/Elezioni/ele_operatori.php	(revision 53)
+++ trunk/admin/modules/Elezioni/ele_operatori.php	(revision 257)
@@ -15,6 +15,8 @@
 $perms=ChiSei($id_cons_gen);
 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!");
-$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);
-list($tipo_cons,$id_cons) = mysql_fetch_row($res);
+$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'";
+$res = $dbi->prepare("$sql");
+$res->execute();	
+list($tipo_cons,$id_cons) = $res->fetch(PDO::FETCH_NUM);
 if (isset($_GET['aid2'])) get_magic_quotes_gpc() ? $aid2=$param['aid2']:$aid2=addslashes($param['aid2']); else {if ($perms==256) $aid2='admin'; else $aid2='';}
 if (isset($_GET['id_sede'])) $id_sede=intval($_GET['id_sede']); else $id_sede='';
@@ -38,8 +40,12 @@
 	$id_comune=$_SESSION['id_comune'];
 	$user=$aid;
-	$rescom = mysql_query("select descrizione from ".$prefix."_ele_comuni where id_comune=$id_comune",$dbi);
-	list($descr_com) = mysql_fetch_row($rescom);
-	$resmod = mysql_query("SELECT aid,name,email FROM ".$prefix."_authors where aid='$aid2' and id_comune='$id_comune'", $dbi);
-	list ($aid2,$name,$email) = mysql_fetch_row($resmod);
+	$sql="select descrizione from ".$prefix."_ele_comuni where id_comune=$id_comune";
+	$rescom = $dbi->prepare("$sql");
+	$rescom->execute();	
+	list($descr_com) = $rescom->fetch(PDO::FETCH_NUM);
+	$sql="SELECT aid,name,email FROM ".$prefix."_authors where aid='$aid2' and id_comune='$id_comune'";
+	$resmod = $dbi->prepare("$sql");
+	$resmod->execute();	
+	list ($aid2,$name,$email) = $resmod->fetch(PDO::FETCH_NUM);
 	if (isset($_GET['mex'])){
 		echo "<table align=\"center\"><tr><td style=\"background-color: rgb(255, 0, 0)\">";
@@ -54,10 +60,12 @@
 	echo "<table style=\"color: #000000;\"><tr align=\"center\" bgcolor=\"$bgcolor1\">";
 	echo "<td><b>"._UTENTE."</b></td>";
-	$resins = mysql_query("select aid from ".$prefix."_authors where id_comune='$id_comune' order by aid",$dbi); 
+	$sql="select aid from ".$prefix."_authors where id_comune='$id_comune' order by aid"; 
+	$resins = $dbi->prepare("$sql");
+	$resins->execute();	
 	echo "</tr><tr align=\"center\">";
 	echo "<td><input type=\"hidden\" name=\"pag_op\" value=\"admin.php?op=operatori&amp;id_cons_gen=$id_cons_gen&amp;aid2=\">";
 	echo "<select name=\"aid2\" onChange=\"top.location.href=this.form.pag_op.value+this.form.aid2.options[this.form.aid2.selectedIndex].value;return false\">";
 	echo "<option value=\"\">";
-	while(list($utente)=mysql_fetch_row($resins)){
+	while(list($utente)=$resins->fetch(PDO::FETCH_NUM)){
 		$sel= ($utente == $aid2) ? "selected":"";
 		echo "<option value=\"$utente\" $sel>$utente";
@@ -66,5 +74,7 @@
 	echo "</select></td>";
 	echo "</tr></table></form><br><hr>";
-	$resmod = mysql_query("SELECT * FROM ".$prefix."_authors where id_cons='$id_cons' and id_comune='$id_comune'", $dbi);
+#	$sql="SELECT * FROM ".$prefix."_authors where id_cons='$id_cons' and id_comune='$id_comune'";
+#	$resmod = $dbi->prepare("$sql");
+#	$resmod->execute();	
 	echo "<form name=\"modello\" action=\"admin.php\">";
 	echo "<table style=\"color: #000000;\">";
@@ -111,12 +121,16 @@
 		if ($do == "add") {
 			$sql="select * from ".$prefix."_authors where aid='$aid2' and id_comune=$id_comune";
-			$res=mysql_query($sql,$dbi);
-			$max=mysql_num_rows($res);
+			$res = $dbi->prepare("$sql");
+			$res->execute();	
+			$max=$res->rowCount();
 			if ($passwd==$passwd2 and $max==0){
 				if ($aid2=='admin') $super='1,0,0,'; else $super = '0,1,0,';
 				$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')";
-				$result = mysql_query($sql, $dbi)||die("Errore 1301: Non e' stato possibile inserire l'utente!<br>$sql<br>".mysql_error());
+				$res = $dbi->prepare("$sql");
+				$res->execute();	
 				if ($perms==256 and $aid2=='admin'){
-					$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());
+					$sql="insert into ".$prefix."_ele_operatori (id_cons,id_sede,id_comune,permessi,aid) values ('0','0','$id_comune','64','$aid2')";
+					$res = $dbi->prepare("$sql");
+					$res->execute();	
 				}
 			Header("Location: admin.php?op=operatori&id_cons_gen=$id_cons_gen");
@@ -128,5 +142,7 @@
 			}
 		} elseif ($do == "update") {
-			$result = mysql_query("update  ".$prefix."_authors set name='$name',pwd='".md5($passwd)."', email='$email' where id_comune='$id_comune' and aid='$aid2' ", $dbi);
+			$sql="update  ".$prefix."_authors set name='$name',pwd='".md5($passwd)."', email='$email' where id_comune='$id_comune' and aid='$aid2' ";
+			$res = $dbi->prepare("$sql");
+			$res->execute();	
 			if (!$result) return;
 			if ($aid2==$aid) $_SESSION['pwd']=md5($passwd);
