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=''; if (isset($param['do'])) get_magic_quotes_gpc() ? $do=$param['do']:$do=addslashes($param['do']); else $do=''; if (isset($param['permessi'])) get_magic_quotes_gpc() ? $permessi=$param['permessi']:$permessi=addslashes($param['permessi']); else $permessi=''; if (isset($param['id_comune2'])) $id_comune2=intval($param['id_comune2']); else $id_comune2=''; if (isset($param['ok'])) $ok=intval($param['ok']); else $ok=''; if (isset($param['mex'])) get_magic_quotes_gpc() ? $mex=$param['mex']:$mex=addslashes($param['mex']); else $mex=''; include("modules/Elezioni/funzionidata.php"); include("modules/Elezioni/ele.php"); /******************************************************/ /*Funzione di visualizzazione globale */ /*****************************************************/ //crea la pagina delle affluenze function all() { global $adminop,$adminsuper,$admincomune,$aid, $offset, $prefix, $dbi,$id_cons,$aid2,$permessi,$id_sede,$id_cons_gen,$id_comune,$mex; $bgcolor1=$_SESSION['bgcolor1']; if (isset($mex)){ echo "
"; echo $mex; echo "
"; } OpenTable(); $sql="SELECT * FROM ".$prefix."_ele_operatori where id_cons=$id_cons and permessi<64 order by aid"; $resmod = $dbi->prepare("$sql"); $resmod->execute(); echo "
"; echo "" ."" .""; echo ""; $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) = $restmp->fetch(PDO::FETCH_NUM)){ //elenco degli operatori gia' autorizzati $listmp .= $virg."'".$artmp."'"; $virg=','; } } if (!$listmp) $listmp="''"; $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(); echo "" .""; echo ""; echo ""; $sql="SELECT id_sede, indirizzo from ".$prefix."_ele_sede where id_cons=$id_cons"; $ressede = $dbi->prepare("$sql"); $ressede->execute(); echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"._UTENTE.""._SEDE.""._PERMESSI.""._FUNZIONI."
"; echo "


"; if($resmod->rowCount()){ $i=1; while (list($id_cons2,$id_sede2,$id_comunetemp,$perm,$utente) = $resmod->fetch(PDO::FETCH_NUM)){ $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; echo "" .""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $sql="SELECT id_sede, indirizzo from ".$prefix."_ele_sede where id_cons=$id_cons"; $ressede = $dbi->prepare("$sql"); $ressede->execute(); echo ""; echo ""; echo ""; $i++; } } echo "
$utente
"; CloseTable(); } function permessi($ok, $do,$aid2,$id_sede,$permessi,$id_comune) { global $prefix, $dbi, $id_cons,$id_cons_gen,$currentlang; $perms=ChiSei($id_cons_gen); if ($perms!=256) $id_comune=$_SESSION['id_comune']; if ($perms>32 and $permessi<$perms and $aid2) { if ($do == "autorizza") { $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") { $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(); $result=$res->rowCount(); if (!$result) return; Header("Location: admin.php?op=permessi&id_cons_gen=$id_cons_gen"); } } } //**************************** // switch //**************************** if ($do) permessi($ok, $do,$aid2,$id_sede,$permessi,$id_comune); ele(); all(); include("footer.php"); ?>