Index: trunk/admin/modules/Elezioni/ele_confcons.php
===================================================================
--- trunk/admin/modules/Elezioni/ele_confcons.php	(revision 254)
+++ trunk/admin/modules/Elezioni/ele_confcons.php	(revision 257)
@@ -15,7 +15,6 @@
 // Offset - visualizza il numero di elementi per pagina
 $offset=5;
-
+global $db1;
 $aid=$_SESSION['aid'];
-$dbi=$_SESSION['dbi'];
 $prefix=$_SESSION['prefix'];
 $currentlang=$_SESSION['lang'];
@@ -26,6 +25,8 @@
 
 $id_comune=$_SESSION['id_comune'];
-$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);
 
 include("modules/Elezioni/funzionidata.php");
@@ -66,12 +67,16 @@
 
 	//-----------------------visualizza blocco inserimento -
-	$res = mysql_query("SELECT * FROM ".$prefix."_ele_conf", $dbi); //da modificare
-	$max = mysql_num_rows($res);
+	$sql="SELECT * FROM ".$prefix."_ele_conf"; //da modificare
+	$res = $dbi->prepare("$sql");
+	$res->execute();	
+	$max = $res->rowCount();
 	$nuovo_gruppo=$max+1;
 	echo "<form name=\"gruppo2\" enctype=\"multipart/form-data\" action=\"admin.php\" method=\"post\">"
 	."<input type=\"hidden\" name=\"op\" value=\"confconsiglio\">";
 	if ($do=='modify') {
-	$resl = mysql_query("SELECT * FROM ".$prefix."_ele_conf where id_conf='$id_conf'", $dbi);
-	$gru=mysql_fetch_array($resl);
+	$sql="SELECT * FROM ".$prefix."_ele_conf where id_conf='$id_conf'";
+	$res1 = $dbi->prepare("$sql");
+	$res1->execute();	
+	$gru=$resl->fetch(PDO::FETCH_BOTH);
 	$nuovo_gruppo=$gru['id_conf'];
 	echo "<input type=\"hidden\" name=\"do\" value=\"update\">";
@@ -85,10 +90,12 @@
 	."<tr><td align=\"center\"><b>"._LIMITE."</b></td><td><select name=\"limite\"><option value=\"0\">"._NOFASCIA;
 		
-		$result1 = mysql_query("select id_fascia, abitanti from ".$prefix."_ele_fasce where id_conf='".$gru['id_conf']."' order by id_fascia", $dbi);
-		while(list($id,$descr)=mysql_fetch_row($result1)){
-			$sel= ($id == $gru['limite']) ? "selected":"";
-			echo "<option value=\"$id\" $sel>$descr";
-		}
-		echo "</select></td>";
+	$sql="select id_fascia, abitanti from ".$prefix."_ele_fasce where id_conf='".$gru['id_conf']."' order by id_fascia";
+	$result1 = $dbi->prepare("$sql");
+	$result1->execute();	
+	while(list($id,$descr)=$result1->fetch(PDO::FETCH_NUM)){
+		$sel= ($id == $gru['limite']) ? "selected":"";
+		echo "<option value=\"$id\" $sel>$descr";
+	}
+	echo "</select></td>";
 	$sel= ($gru['consin']==1) ? "selected":"";
 	echo "<td align=\"center\"><b>"._CONSIN."</b></td><td><select name=\"consin\"><option value=\"0\">No<option value=\"1\" $sel>Si</select></td></tr>"
@@ -116,8 +123,12 @@
 		
 		
-	$res = mysql_query("SELECT * FROM ".$prefix."_ele_conf", $dbi);
-	$max = mysql_num_rows($res);
-	$result = mysql_query("select * from ".$prefix."_ele_conf ORDER BY id_conf  LIMIT $min,$offset", $dbi);
-	while(list($id_conf,$descrizione,$limite, $consin,$infpremio, $supsbarramento, $suppremio, $listinfsbar, $listinfconta, $listsupconta) = mysql_fetch_row($result)) {
+	$sql="SELECT * FROM ".$prefix."_ele_conf";
+	$res = $dbi->prepare("$sql");
+	$res->execute();	
+	$max = $res->rowCount();
+	$sql="select * from ".$prefix."_ele_conf ORDER BY id_conf  LIMIT $min,$offset";
+	$result = $dbi->prepare("$sql");
+	$result->execute();	
+	while(list($id_conf,$descrizione,$limite, $consin,$infpremio, $supsbarramento, $suppremio, $listinfsbar, $listinfconta, $listsupconta) = $result->fetch(PDO::FETCH_NUM)) {
 		$bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1'];
 		echo "<tr bgcolor=\"$bgcolor1\"><td align=\"center\"><b>$id_conf</b></td>"
@@ -179,6 +190,8 @@
 				echo "[ <a href=\"admin.php?op=confconsiglio&amp;id_cons_gen=$id_cons_gen&amp;id_conf=$id_conf\">"._NO."</a> ] - [<a href=\"admin.php?op=confconsiglio&amp;do=delete&amp;id_conf=$id_conf&amp;id_cons_gen=$id_cons_gen&amp;id_comune=$id_comune&amp;ok=1\">"._YES."</a> ]";exit;
      			}else{
-				$result = mysql_query("delete from ".$prefix."_ele_conf where id_conf='$id_conf'", $dbi);
-          			if (!$result) return;
+				$sql="delete from ".$prefix."_ele_conf where id_conf='$id_conf'";
+				$result = $dbi->prepare("$sql");
+				$result->execute();	
+          		if (!$result->rowCount()) return;
 				Header("Location: admin.php?op=confconsiglio&id_cons_gen=$id_cons_gen&id_conf=$id_conf&min=$min");
 			}
@@ -186,6 +199,8 @@
       			if ($descrizione) {
 				$sqlset='';
-      				$result = mysql_query("insert into ".$prefix."_ele_conf(id_conf,descrizione, limite,consin,infpremio,supsbarramento,suppremio,listinfsbar,listinfconta,listsupconta,infminpremio,supminpremio) values ('$id_conf','$descrizione','$limite','$consin','$infpremio','$supsbarramento','$suppremio','$listinfsbar','$listinfconta','$listsupconta','$infminpremio','$supminpremio')", $dbi) || die("Errore di aggiornamento dei dati!".mysql_error());
-           			if (!$result) return;
+      			$sql="insert into ".$prefix."_ele_conf(id_conf,descrizione, limite,consin,infpremio,supsbarramento,suppremio,listinfsbar,listinfconta,listsupconta,infminpremio,supminpremio) values ('$id_conf','$descrizione','$limite','$consin','$infpremio','$supsbarramento','$suppremio','$listinfsbar','$listinfconta','$listsupconta','$infminpremio','$supminpremio')";
+				$result = $dbi->prepare("$sql");
+				$result->execute();	
+           			if (!$result->rowCount()) return;
            			Header("Location: admin.php?op=confconsiglio&id_cons_gen=$id_cons_gen&min=$min");
      			} else {
@@ -197,5 +212,7 @@
      			}
    		} elseif ($do == "update") {
-			$result = mysql_query("update  ".$prefix."_ele_conf set descrizione='$descrizione', limite='$limite', consin='$consin', infpremio='$infpremio', supsbarramento='$supsbarramento', suppremio='$suppremio', listinfsbar='$listinfsbar', listinfconta='$listinfconta', listsupconta='$listsupconta', infminpremio='$infminpremio', supminpremio='$supminpremio' where id_conf='$id_conf' ", $dbi) || die("Errore di aggiornamento dei dati!".mysql_error());
+			$sql="update  ".$prefix."_ele_conf set descrizione='$descrizione', limite='$limite', consin='$consin', infpremio='$infpremio', supsbarramento='$supsbarramento', suppremio='$suppremio', listinfsbar='$listinfsbar', listinfconta='$listinfconta', listsupconta='$listsupconta', infminpremio='$infminpremio', supminpremio='$supminpremio' where id_conf='$id_conf' ";
+			$result = $dbi->prepare("$sql");
+			$result->execute();	
 			Header("Location: admin.php?op=confconsiglio&id_cons_gen=$id_cons_gen&min=$min");
    		}
