prepare("$sql"); $res->execute(); list($tipo_cons) = $res->fetch(PDO::FETCH_NUM); $hiddenInfo = ""; /******************************************************/ /*Funzione di visualizzazione globale */ /******************************************************/ //crea la pagina delle affluenze function all() { global $bgcolor1, $bgcolor2, $prefix,$aid2,$perms,$id_sede,$id_comune2,$id_cons_gen; $aid=$_SESSION['aid']; $dbi=$_SESSION['dbi']; $prefix=$_SESSION['prefix']; OpenTable(); $sql="SELECT id_comune,permessi FROM ".$prefix."_ele_operatori where id_cons='0' and aid='$aid' and id_comune='0'"; $resmod = $dbi->prepare("$sql"); $resmod->execute(); list ($id_comu,$permessi) = $resmod->fetch(PDO::FETCH_NUM); if ($perms!=256) { Closetable(); return; } $sql="SELECT * FROM ".$prefix."_ele_operatori where id_cons=0 and id_comune>0"; $resmod = $dbi->prepare("$sql"); $resmod->execute(); echo "
"; echo "" ."" .""; echo ""; echo "" .""; echo ""; if ($aid2) { echo ""; }else{ echo ""; } $sql="SELECT id_comune, descrizione from ".$prefix."_ele_comuni"; $ressede = $dbi->prepare("$sql"); $ressede->execute(); echo ""; echo ""; echo ""; echo ""; if ($aid2) { echo ""; echo ""; }else{ echo ""; echo ""; } $i=1; while (list($id_cons2,$id_sede2,$id_comune2,$perm,$utente) = $resmod->fetch(PDO::FETCH_NUM)){ //elenco dei modelli inseriti $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; echo "" .""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; if ($perm==64) {$perm_text=_ATTIVO;}else{$perm_text=_SOSPESO;} echo ""; echo ""; $i++; } echo "
"._UTENTE.""._DEFCOMUNE.""._PERMESSI.""._FUNZIONI."
$aid2
$utente".$arr[$id_comune2]."$perm_text[ "._EDIT."]"; echo "
"; CloseTable(); } function oper_admin() { global $bgcolor1, $bgcolor2, $prefix, $dbi,$id_cons_gen; $aid=$_SESSION['aid']; $dbi=$_SESSION['dbi']; $prefix=$_SESSION['prefix']; $pwd=$_SESSION['pwd']; $perms=ChiSei(0); if ($perms==256) { $aid2=$_GET['aid2']; $do=$_GET['do']; $id_comune2=$_GET['id_comune2']; $permessi=$_GET['permessi']; if ($do == "add") { if ($aid2) { # $result = mysql_query("select * from ".$prefix."_ele_operatori where aid='$aid2'", $dbi); $sql="insert into ".$prefix."_ele_operatori (id_cons,id_sede,id_comune,permessi,aid) values ('0','0','$id_comune2','$permessi','$aid2')"; $res = $dbi->prepare("$sql"); $res->execute(); Header("Location: admin.php?op=oper_admin&id_cons_gen=$id_cons_gen"); } else { OpenTable(); echo "
"._GESTIONE." "._OPERATORI." aid=$aid2; "; echo "

"._IMM." "._OPERATORI."
"; CloseTable(); } }else if ($do == "update") { $sql="update ".$prefix."_ele_operatori set permessi='$permessi' where id_cons='0' and aid='$aid2' "; $res = $dbi->prepare("$sql"); $res->execute(); Header("Location: admin.php?op=oper_admin&id_cons_gen=$id_cons_gen"); } }else die("Non ci provare..."); } //**************************** // switch //**************************** if ($do!="") oper_admin(); include("modules/Elezioni/funzionidata.php"); include("modules/Elezioni/ele.php"); ele(); all(); include("footer.php"); ?>