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_comuni.php

    r247 r257  
    1212    die ("You can't access this file directly...");
    1313}
    14 #foreach($_FILES as $key=>$val) echo $key;die();
     14#foreach($_SESSION as $key=>$val) echo "$key : $val<br>";die();
     15global $dbi;
    1516$aid=$_SESSION['aid'];
    16 $dbi=$_SESSION['dbi'];
     17#$dbi=$_SESSION['dbi'];
    1718$prefix=$_SESSION['prefix'];
    1819$id_comune=$_SESSION['id_comune'];
     
    3637if (isset($param['cap'])) get_magic_quotes_gpc() ? $cap=$param['cap']:$cap=addslashes($param['cap']); else $cap='';
    3738
    38         $res = mysql_query("SELECT t1.tipo_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_comune='$id_comune' " , $dbi);
    39         list($tipo_cons) = mysql_fetch_row($res);
    40         $res = mysql_query("SELECT genere FROM ".$prefix."_ele_tipo where tipo_cons='$tipo_cons' " , $dbi);
    41         list($genere) = mysql_fetch_row($res);
     39        $sql="SELECT t1.tipo_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_comune='$id_comune' ";
     40        $res = $dbi->prepare("$sql");
     41        $res->execute();       
     42        list($tipo_cons) = $res->fetch(PDO::FETCH_NUM);
     43        $sql="SELECT genere FROM ".$prefix."_ele_tipo where tipo_cons='$tipo_cons' ";
     44        $res = $dbi->prepare("$sql");
     45        $res->execute();       
     46        list($genere) = $res->fetch(PDO::FETCH_NUM);
    4247        include("modules/Elezioni/funzionidata.php");
    4348        include("modules/Elezioni/ele.php");
     
    7075
    7176 
    72         $resmod = mysql_query("SELECT id_comune,descrizione,indirizzo,centralino,fax,email,fascia,capoluogo,simbolo,cap FROM ".$prefix."_ele_comuni where descrizione like '$cerca%' order by descrizione", $dbi);
     77        $sql="SELECT id_comune,descrizione,indirizzo,centralino,fax,email,fascia,capoluogo,simbolo,cap FROM ".$prefix."_ele_comuni where descrizione like '$cerca%' order by descrizione";
     78        $resmod = $dbi->prepare("$sql");
     79        $resmod->execute();     
     80#       list($tipo_cons) = $resmod->fetch(PDO::FETCH_NUM);
    7381        echo "<table width=\"100%\"><tr><td bgcolor=\"$bgcolor2\"> <form name=\"cerca\" action=\"admin.php\">"
    7482        ."<input type=\"hidden\" name=\"op\" value=\"inscomuni\">";
     
    97105        echo "<tr><td bgcolor=\"$bgcolor1\"><b>"._FASCIA."</b></td><td><select name=\"fascia\">";
    98106        $descr2="<";
    99                         $resopt1 = mysql_query("select id_fascia, abitanti from ".$prefix."_ele_fasce where id_conf=1 order by id_fascia", $dbi);
    100                 while(list($id,$descr)=mysql_fetch_row($resopt1)){
     107        $sql="select id_fascia, abitanti from ".$prefix."_ele_fasce where id_conf=1 order by id_fascia";
     108        $resopt1 = $dbi->prepare("$sql");
     109        $resopt1->execute();   
     110                while(list($id,$descr)=$resopt1->fetch(PDO::FETCH_NUM)){
    101111                        $selid= ($id == $fasciatmp) ? "selected":"";
    102112                       
     
    134144
    135145####
    136         while (list($id_comune2,$desc,$indirizzo,$centralino,$fax,$email,$fasciatmp,$prov,$simbolo,$cap) = mysql_fetch_row($resmod)){ //elenco dei modelli inseriti
     146        while (list($id_comune2,$desc,$indirizzo,$centralino,$fax,$email,$fasciatmp,$prov,$simbolo,$cap) = $resmod->fetch(PDO::FETCH_NUM)){ //elenco dei modelli inseriti
    137147                $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1'];
    138148                if (!$simbolo) $simbolo="nulla.jpg";
     
    154164                echo "<td><b>".substr($email,0,15)."...</b></td>";
    155165                echo "<td><b>$cap</b></td>";
    156                 $resopt1 = mysql_query("select abitanti from ".$prefix."_ele_fasce where id_fascia=$fasciatmp and id_conf=$id_conf", $dbi);
    157                 list($tmpfascia)=mysql_fetch_row($resopt1);
     166                $sql="select abitanti from ".$prefix."_ele_fasce where id_fascia=$fasciatmp and id_conf=$id_conf";
     167                $resopt1 = $dbi->prepare("$sql");
     168                $resopt1->execute();   
     169                list($tmpfascia)=$resopt1->fetch(PDO::FETCH_NUM);
    158170                $fasciaref=$fasciatmp-1;
    159                 $resopt1 = mysql_query("select abitanti from ".$prefix."_ele_fasce where id_fascia=$fasciaref and id_conf=$id_conf", $dbi);
    160                 if(mysql_num_rows($resopt1)==0) $valfascia="< $tmpfascia";
     171                $sql="select abitanti from ".$prefix."_ele_fasce where id_fascia=$fasciaref and id_conf=$id_conf";
     172                $resopt1 = $dbi->prepare("$sql");
     173                $resopt1->execute();   
     174                if($resopt1->rowCount()==0) $valfascia="< $tmpfascia";
    161175                else
    162176                {
    163                     list($tmp2fascia)=mysql_fetch_row($resopt1);
     177                    list($tmp2fascia)=$resopt1->fetch(PDO::FETCH_NUM);
    164178                        $valfascia="$tmp2fascia - $tmpfascia";
    165179                }
     
    219233                                        $stemmanome=addslashes($nomestemma);
    220234                                }
    221                         $result = mysql_query("insert into ".$prefix."_ele_comuni (id_comune,descrizione,indirizzo,centralino,fax,email,fascia,capoluogo,simbolo,stemma,cap) values ('$id_comune','$desc','$indirizzo','$centralino','$fax','$email','$fasciatmp','$prov','$stemmanome','$stemmablob','$cap')", $dbi) || die("<br><br>Errore di inserimento: ".mysql_error());
    222                         Header("Location: admin.php?op=inscomuni&id_cons_gen=$id_cons_gen");
     235                        $sql = "insert into ".$prefix."_ele_comuni (id_comune,descrizione,indirizzo,centralino,fax,email,fascia,capoluogo,simbolo,stemma,cap) values ('$id_comune','$desc','$indirizzo','$centralino','$fax','$email','$fasciatmp','$prov','$stemmanome','$stemmablob','$cap')";
     236                                $result = $dbi->prepare("$sql");
     237                                $result->execute();     
     238                        Header("Location: admin.php?op=inscomuni&id_cons_gen=$id_cons_gen");
    223239                } else {
    224240                        OpenTable();
     
    242258                                $cond=", simbolo='$stemmanome', stemma='$stemmablob'";
    243259                        } else {$cond='';$stemmanome=''; $stemmablob='';}
    244                 $result = mysql_query("update  ".$prefix."_ele_comuni set descrizione='$desc' , indirizzo='$indirizzo', centralino='$centralino', fax='$fax' , cap='$cap' , email='$email', fascia='$fasciatmp',capoluogo='$prov' $cond where id_comune='$id_comune'", $dbi) || die("<br><br>Errore di inserimento: ".mysql_error());
     260                $sql = "update  ".$prefix."_ele_comuni set descrizione='$desc' , indirizzo='$indirizzo', centralino='$centralino', fax='$fax' , cap='$cap' , email='$email', fascia='$fasciatmp',capoluogo='$prov' $cond where id_comune='$id_comune'";
     261                        $result = $dbi->prepare("$sql");
     262                        $result->execute();     
    245263                Header("Location: admin.php?op=inscomuni&id_cons_gen=$id_cons_gen");
    246264        }
Note: See TracChangeset for help on using the changeset viewer.