prepare("$sql"); $res->execute(); list($tipo_cons,$id_cons) = $res->fetch(PDO::FETCH_NUM); if (isset($param['do'])) get_magic_quotes_gpc() ? $do=$param['do']:$do=addslashes($param['do']); else $do=''; if (isset($param['id_sede'])) $id_sede=intval($param['id_sede']); else $id_sede=''; if (isset($param['min'])) $min=intval($param['min']); else $min=0; if (isset($param['ok'])) $ok=intval($param['ok']); else $ok=''; if (isset($param['id_sez'])) $id_sez=intval($param['id_sez']); else $id_sez=''; if (isset($param['aut_m'])) $aut_m=intval($param['aut_m']); else $aut_m=''; if (isset($param['aut_f'])) $aut_f=intval($param['aut_f']); else $aut_f=''; if (isset($param['maschi'])) $maschi=intval($param['maschi']); else $maschi=''; if (isset($param['femmine'])) $femmine=intval($param['femmine']); else $femmine=''; if (isset($param['id_sez2'])) $id_sez2=intval($param['id_sez2']); else $id_sez2=''; if (isset($param['num_sez'])) $num_sez=intval($param['num_sez']); else $num_sez=''; include("modules/Elezioni/funzionidata.php"); include("modules/Elezioni/ele.php"); // Offset - visualizza il numero di elementi per pagina $offset=10; $hiddenInfo = ""; /******************************************************/ /*Funzione di visualizzazione globale */ /*****************************************************/ function all() { global $admin, $bgcolor1, $bgcolor2, $prefix, $dbi, $offset, $min, $id_cons,$id_cons_gen; # OpenTable(); $y=0; echo "
"._SEZIONE."

" ."" ."" ."" ."" ."" .""; $sql="SELECT * FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' "; $res = $dbi->prepare("$sql"); $res->execute(); $max = $res->rowCount(); echo "" ."" .""; $nuova= $max+1; $sql="SELECT id_sede FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' and num_sez='$max' "; $res = $dbi->prepare("$sql"); $res->execute(); list($id_sede_old) = $res->fetch(PDO::FETCH_NUM); echo ""; echo ""; //************************************* echo ""; echo ""; echo "" .""; $sql="select id_cons, id_sez, id_sede, num_sez, maschi, femmine, autorizzati_m, autorizzati_f from ".$prefix."_ele_sezioni where id_cons='$id_cons' ORDER BY num_sez LIMIT $min,$offset"; $result = $dbi->prepare("$sql"); $result->execute(); while(list($id_cons2,$id_sez,$id_sede,$num_sez, $maschi, $femmine,$aut_m,$aut_f) = $result->fetch(PDO::FETCH_NUM)) { $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; // dati circoscrizione $sql="select indirizzo from ".$prefix."_ele_sede where id_sede='$id_sede'"; $result1 = $dbi->prepare("$sql"); $result1->execute(); list($indir)=$result1->fetch(PDO::FETCH_NUM); $totali=$maschi+$femmine+$aut_m+$aut_f; $y++; echo "" ."" ."" ."" ."" ."" .""; echo ""; echo ""; echo "\n"; } echo "
"._NUM.""._INDIRIZZO.""._MASCHI.""._FEMMINE.""._TOTS." "._ISCRITTI.""._FUNZIONI."
"; echo "" ."
$num_sez"; echo ""; echo "$totali" ."
" ."" ; echo "" ."["._DELETE."]
"; echo "
"; echo "\n"; #'Pagina precedente' e 'Pagina Successiva' echo""; if ($min<$offset and $min!=0) $min=$offset; $prev=$min-$offset; if ($prev>=0) { echo ""; } $next=$min+$offset; if ($next>=($offset-1)) { if($next>=$max) $next = $max; else { echo ""; } } echo "
"; echo ""._PREV_MATCH.""; echo ""._NEXT_MATCH."

"; #CloseTable(); #include("footer.php"); } function sezione($ok, $do,$id_sede,$id_sez, $num_sez, $aut_ma, $aut_fe, $maschi, $femmine, $id_sez2,$min) { global $admin, $bgcolor1, $bgcolor2, $prefix, $dbi, $descr_cons, $id_cons,$id_cons_gen; $perms=ChiSei($id_cons_gen); if ($perms>16) { $aut_m=intval($aut_ma); $aut_f=intval($aut_fe); if ($do == "delete") { if ($ok !="1") { ele(); echo "


"._DOMCANCELLA." "._NUM." "._SEZIONE." $num_sez ?
"; echo "[ "._NO." ] - ["._YES." ]"; include("footer.php"); die(); }else{ $sql="delete from ".$prefix."_ele_voti_candidati where id_sez='$id_sez'"; $res = $dbi->prepare("$sql"); $res->execute(); $sql="delete from ".$prefix."_ele_voti_lista where id_sez='$id_sez'"; $res = $dbi->prepare("$sql"); $res->execute(); $sql="delete from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez'"; $res = $dbi->prepare("$sql"); $res->execute(); $sql="delete from ".$prefix."_ele_voti_ref where id_sez='$id_sez'"; $res = $dbi->prepare("$sql"); $res->execute(); $sql="delete from ".$prefix."_ele_voti_parziale where id_sez='$id_sez'"; $res = $dbi->prepare("$sql"); $res->execute(); $sql="delete from ".$prefix."_ele_sezioni where id_sez='$id_sez'"; $res = $dbi->prepare("$sql"); $res->execute(); Header("Location: admin.php?op=sezione&id_cons_gen=$id_cons_gen&min=$min"); } }elseif ($do == "add") { if ($num_sez) { $sql="insert into ".$prefix."_ele_sezioni (id_cons,id_sede,num_sez,maschi,femmine, autorizzati_m,autorizzati_f) values ('$id_cons', '$id_sede', '$num_sez','$maschi','$femmine','$aut_m', '$aut_f')"; $res = $dbi->prepare("$sql"); $res->execute(); Header("Location: admin.php?op=sezione&id_cons_gen=$id_cons_gen&min=$min"); } else { ele(); OpenTable(); echo "
"._GESTIONE." "._SEZIONE." "; echo "

"._IMM." "._SEZIONE."
"; CloseTable(); } }elseif ($do == "update") { $sql="update ".$prefix."_ele_sezioni set id_sede='$id_sede', maschi='$maschi', femmine='$femmine', autorizzati_m='$aut_m', autorizzati_f='$aut_f' where id_sez='$id_sez2' "; $res = $dbi->prepare("$sql"); $res->execute(); $num_sez--; Header("Location: admin.php?op=sezione&id_cons_gen=$id_cons_gen&min=$num_sez"); } } } if ($op=="sezione") sezione($ok, $do,$id_sede,$id_sez, $num_sez, $aut_m, $aut_f, $maschi, $femmine, $id_sez2, $min); ele(); all(); echo""; include ("footer.php"); ?>