Index: trunk/admin/modules/Elezioni/ele_permessi.php
===================================================================
--- trunk/admin/modules/Elezioni/ele_permessi.php	(revision 2)
+++ trunk/admin/modules/Elezioni/ele_permessi.php	(revision 257)
@@ -19,6 +19,8 @@
 $perms=ChiSei($id_cons_gen);
 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!");
-$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($param['aid2'])) get_magic_quotes_gpc() ? $aid2=$param['aid2']:$aid2=addslashes($param['aid2']); else $aid2='';
 if (isset($param['id_sede'])) $id_sede=intval($param['id_sede']); else $id_sede='';
@@ -45,5 +47,7 @@
 	}	
 	OpenTable();
-	$resmod = mysql_query("SELECT * FROM ".$prefix."_ele_operatori where id_cons=$id_cons and permessi<64 order by aid", $dbi);
+	$sql="SELECT * FROM ".$prefix."_ele_operatori where id_cons=$id_cons and permessi<64 order by aid";
+	$resmod = $dbi->prepare("$sql");
+	$resmod->execute();				
 
 	echo "<br><table><tr align=\"center\" bgcolor=\"$bgcolor1\">";
@@ -55,8 +59,10 @@
 	
 		
-	$restmp = mysql_query("SELECT aid FROM ".$prefix."_ele_operatori where id_cons=$id_cons and permessi<64 order by aid", $dbi);
+	$sql="SELECT aid FROM ".$prefix."_ele_operatori where id_cons=$id_cons and permessi<64 order by aid";
+	$restmp = $dbi->prepare("$sql");
+	$restmp->execute();				
 	if($restmp) {
 	$listmp='';$virg='';
-	while (list($artmp) = mysql_fetch_row($restmp)){ //elenco degli operatori gia' autorizzati
+	while (list($artmp) = $restmp->fetch(PDO::FETCH_NUM)){ //elenco degli operatori gia' autorizzati
 		$listmp .= $virg."'".$artmp."'";
 		$virg=',';
@@ -65,5 +71,7 @@
         
 	if (!$listmp) $listmp="''";
-	$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
+	$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
+	$resins = $dbi->prepare("$sql");
+	$resins->execute();				
 	
          
@@ -73,15 +81,17 @@
 	echo "<td><select name=\"aid2\">";
 	echo "<option value=\"\">";
-	if($resins) {
-		while(list($utente)=mysql_fetch_row($resins)){
+	if($resins->rowCount()) {
+		while(list($utente)=$resins->fetch(PDO::FETCH_NUM)){
 			echo "<option value=\"$utente\">$utente";
 		}
 	}
 	echo "</select></td>";
-	$ressede = mysql_query("SELECT id_sede, indirizzo from ".$prefix."_ele_sede where id_cons=$id_cons", $dbi);
+	$ressede = mysql_query("SELECT id_sede, indirizzo from ".$prefix."_ele_sede where id_cons=$id_cons";
+	$ressede = $dbi->prepare("$sql");
+	$ressede->execute();				
 	echo "<td><select name=\"id_sede\">";
 	echo "<option value=\"0\"> "._TUTTESEDI;
-	if($ressede)
-	while(list($id,$descr)=mysql_fetch_row($ressede)){
+	if($ressede->rowCount())
+	while(list($id,$descr)=$ressede->fetch(PDO::FETCH_NUM)){
 		$sel= ($id == $id_sede) ? "selected":"";
 		$arr[$id]=$descr;
@@ -103,7 +113,7 @@
 	echo "<td><input type=\"submit\" name=\"add\" value=\""._AGGIUNGI."\"></td></tr></form></table>";
 	echo "<br><hr><br><table>";
-	if($resmod){
+	if($resmod->rowCount()){
 		$i=1;
-		while (list($id_cons2,$id_sede2,$id_comunetemp,$perm,$utente) = mysql_fetch_row($resmod)){ 
+		while (list($id_cons2,$id_sede2,$id_comunetemp,$perm,$utente) = $resmod->fetch(PDO::FETCH_NUM)){ 
 			$bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1'];
 			echo "<form name=\"modello$i\" action=\"admin.php\">"
@@ -115,8 +125,10 @@
 			echo "<tr align=\"center\" bgcolor=\"$bgcolor1\">";
 			echo "<td  align=\"center\" width=\"32\"><b>$utente</b></td>";
-			$ressede = mysql_query("SELECT id_sede, indirizzo from ".$prefix."_ele_sede where id_cons=$id_cons", $dbi);
+			$sql="SELECT id_sede, indirizzo from ".$prefix."_ele_sede where id_cons=$id_cons";
+			$ressede = $dbi->prepare("$sql");
+			$ressede->execute();				
 			echo "<td><select name=\"id_sede\">";
 			echo "<option value=\"0\"> "._TUTTESEDI;
-			while(list($id,$descr)=mysql_fetch_row($ressede)){
+			while(list($id,$descr)=$ressede->fetch(PDO::FETCH_NUM)){
 				$sel= ($id == $id_sede2) ? "selected":"";
 				$arr[$id]=$descr;
@@ -147,8 +159,12 @@
 	if ($perms>32 and $permessi<$perms and $aid2) {
 		if ($do == "autorizza") {
-			$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());
+			$sql="insert into ".$prefix."_ele_operatori (id_cons,id_sede,id_comune,permessi,aid) values ('$id_cons','$id_sede','$id_comune','$permessi','$aid2')";
+			$res = $dbi->prepare("$sql");
+			$res->execute();				
 			Header("Location: admin.php?op=permessi&id_cons_gen=$id_cons_gen");
 		} elseif ($do == "update") {
-			$result = mysql_query("update  ".$prefix."_ele_operatori set id_sede='$id_sede' , permessi='$permessi' where id_cons='$id_cons' and aid='$aid2' ", $dbi);
+			$sql="update  ".$prefix."_ele_operatori set id_sede='$id_sede' , permessi='$permessi' where id_cons='$id_cons' and aid='$aid2' ";
+			$res = $dbi->prepare("$sql");
+			$res->execute();				
 			if (!$result) return;
 			Header("Location: admin.php?op=permessi&id_cons_gen=$id_cons_gen");
