Ignore:
Timestamp:
Feb 9, 2019, 8:45:24 PM (5 years ago)
Author:
roby
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/modules/Elezioni/ele_permessi.php

    r2 r257  
    1919$perms=ChiSei($id_cons_gen);
    2020if ($perms<64 or !$id_cons_gen) die("Non hai i permessi per inserire dati ($perms)($id_cons_gen), o non hai scelto la consultazione!");
    21 $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);
    22 list($tipo_cons,$id_cons) = mysql_fetch_row($res);
     21$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'";
     22$res = $dbi->prepare("$sql");
     23$res->execute();                               
     24list($tipo_cons,$id_cons) = $res->fetch(PDO::FETCH_NUM);
    2325if (isset($param['aid2'])) get_magic_quotes_gpc() ? $aid2=$param['aid2']:$aid2=addslashes($param['aid2']); else $aid2='';
    2426if (isset($param['id_sede'])) $id_sede=intval($param['id_sede']); else $id_sede='';
     
    4547        }       
    4648        OpenTable();
    47         $resmod = mysql_query("SELECT * FROM ".$prefix."_ele_operatori where id_cons=$id_cons and permessi<64 order by aid", $dbi);
     49        $sql="SELECT * FROM ".$prefix."_ele_operatori where id_cons=$id_cons and permessi<64 order by aid";
     50        $resmod = $dbi->prepare("$sql");
     51        $resmod->execute();                             
    4852
    4953        echo "<br><table><tr align=\"center\" bgcolor=\"$bgcolor1\">";
     
    5559       
    5660               
    57         $restmp = mysql_query("SELECT aid FROM ".$prefix."_ele_operatori where id_cons=$id_cons and permessi<64 order by aid", $dbi);
     61        $sql="SELECT aid FROM ".$prefix."_ele_operatori where id_cons=$id_cons and permessi<64 order by aid";
     62        $restmp = $dbi->prepare("$sql");
     63        $restmp->execute();                             
    5864        if($restmp) {
    5965        $listmp='';$virg='';
    60         while (list($artmp) = mysql_fetch_row($restmp)){ //elenco degli operatori gia' autorizzati
     66        while (list($artmp) = $restmp->fetch(PDO::FETCH_NUM)){ //elenco degli operatori gia' autorizzati
    6167                $listmp .= $virg."'".$artmp."'";
    6268                $virg=',';
     
    6571       
    6672        if (!$listmp) $listmp="''";
    67         $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
     73        $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
     74        $resins = $dbi->prepare("$sql");
     75        $resins->execute();                             
    6876       
    6977         
     
    7381        echo "<td><select name=\"aid2\">";
    7482        echo "<option value=\"\">";
    75         if($resins) {
    76                 while(list($utente)=mysql_fetch_row($resins)){
     83        if($resins->rowCount()) {
     84                while(list($utente)=$resins->fetch(PDO::FETCH_NUM)){
    7785                        echo "<option value=\"$utente\">$utente";
    7886                }
    7987        }
    8088        echo "</select></td>";
    81         $ressede = mysql_query("SELECT id_sede, indirizzo from ".$prefix."_ele_sede where id_cons=$id_cons", $dbi);
     89        $ressede = mysql_query("SELECT id_sede, indirizzo from ".$prefix."_ele_sede where id_cons=$id_cons";
     90        $ressede = $dbi->prepare("$sql");
     91        $ressede->execute();                           
    8292        echo "<td><select name=\"id_sede\">";
    8393        echo "<option value=\"0\"> "._TUTTESEDI;
    84         if($ressede)
    85         while(list($id,$descr)=mysql_fetch_row($ressede)){
     94        if($ressede->rowCount())
     95        while(list($id,$descr)=$ressede->fetch(PDO::FETCH_NUM)){
    8696                $sel= ($id == $id_sede) ? "selected":"";
    8797                $arr[$id]=$descr;
     
    103113        echo "<td><input type=\"submit\" name=\"add\" value=\""._AGGIUNGI."\"></td></tr></form></table>";
    104114        echo "<br><hr><br><table>";
    105         if($resmod){
     115        if($resmod->rowCount()){
    106116                $i=1;
    107                 while (list($id_cons2,$id_sede2,$id_comunetemp,$perm,$utente) = mysql_fetch_row($resmod)){
     117                while (list($id_cons2,$id_sede2,$id_comunetemp,$perm,$utente) = $resmod->fetch(PDO::FETCH_NUM)){
    108118                        $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1'];
    109119                        echo "<form name=\"modello$i\" action=\"admin.php\">"
     
    115125                        echo "<tr align=\"center\" bgcolor=\"$bgcolor1\">";
    116126                        echo "<td  align=\"center\" width=\"32\"><b>$utente</b></td>";
    117                         $ressede = mysql_query("SELECT id_sede, indirizzo from ".$prefix."_ele_sede where id_cons=$id_cons", $dbi);
     127                        $sql="SELECT id_sede, indirizzo from ".$prefix."_ele_sede where id_cons=$id_cons";
     128                        $ressede = $dbi->prepare("$sql");
     129                        $ressede->execute();                           
    118130                        echo "<td><select name=\"id_sede\">";
    119131                        echo "<option value=\"0\"> "._TUTTESEDI;
    120                         while(list($id,$descr)=mysql_fetch_row($ressede)){
     132                        while(list($id,$descr)=$ressede->fetch(PDO::FETCH_NUM)){
    121133                                $sel= ($id == $id_sede2) ? "selected":"";
    122134                                $arr[$id]=$descr;
     
    147159        if ($perms>32 and $permessi<$perms and $aid2) {
    148160                if ($do == "autorizza") {
    149                         $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());
     161                        $sql="insert into ".$prefix."_ele_operatori (id_cons,id_sede,id_comune,permessi,aid) values ('$id_cons','$id_sede','$id_comune','$permessi','$aid2')";
     162                        $res = $dbi->prepare("$sql");
     163                        $res->execute();                               
    150164                        Header("Location: admin.php?op=permessi&id_cons_gen=$id_cons_gen");
    151165                } elseif ($do == "update") {
    152                         $result = mysql_query("update  ".$prefix."_ele_operatori set id_sede='$id_sede' , permessi='$permessi' where id_cons='$id_cons' and aid='$aid2' ", $dbi);
     166                        $sql="update  ".$prefix."_ele_operatori set id_sede='$id_sede' , permessi='$permessi' where id_cons='$id_cons' and aid='$aid2' ";
     167                        $res = $dbi->prepare("$sql");
     168                        $res->execute();                               
    153169                        if (!$result) return;
    154170                        Header("Location: admin.php?op=permessi&id_cons_gen=$id_cons_gen");
Note: See TracChangeset for help on using the changeset viewer.