Changeset 254 for trunk/admin/admin.php


Ignore:
Timestamp:
Mar 13, 2018, 9:26:23 PM (6 years ago)
Author:
roby
Message:

adeguata la funzione di installazione al php7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/admin.php

    r253 r254  
    153153       
    154154        $row = $sth->fetch(PDO::FETCH_ASSOC);   
    155 #               $res_config = mysql_query("select * from ".$prefix."_config ",$dbi);
    156 #               list ($sitename,$siteurl,$site_logo,$slogan,$startdate,$adminmail,$tema,$foot,$language,$blocco,$testata,$logo,$fileout,$copyright,$versione,$patch,$id_comune,$multicomune,$flash,$displayerrors,$editor,$tema_on,$ed_user) = ($res_config->fetch());
    157                 $siteistat=$row['siteistat'];
     155        $siteistat=$row['siteistat'];
    158156if (!isset($_SESSION['id_comune'])){
    159157        $_SESSION['sitename']=$row['sitename'];
     
    182180        $_SESSION['tema_on']=$tema_on;
    183181        $_SESSION['ed_user']=$ed_user;
    184 }
     182} 
    185183//fine
    186184if (isset($param['aid'])) {
     
    198196                // se superUserAdmin
    199197########
    200                 $res_comune = mysql_query("select adminsuper from ".$prefix."_authors where aid='$aid' and pwd='$mpwd'",$dbi);
    201                 list ($adminsuper) = mysql_fetch_row($res_comune);
    202                 if ($adminsuper==1) $id_comune='0';
     198        $sth = $dbi->prepare("select adminsuper from ".$prefix."_authors where aid='$aid' and pwd='$mpwd'");
     199        $sth->execute();       
     200        $row = $sth->fetch(PDO::FETCH_ASSOC);   
     201                $adminsuper=$row['adminsuper'];
     202                if ($adminsuper==1) $id_comune='0';
    203203                elseif (is_numeric($param['id_comune']) and intval($param['id_comune'])>0) $id_comune=intval($param['id_comune']);
    204                 $res= mysql_query("select counter,admlanguage from ".$prefix."_authors where aid='$aid' and pwd='$mpwd' and id_comune='$id_comune'", $dbi);
    205 
    206                 if ($res){
    207                         $esiste=mysql_num_rows($res);
    208 
    209 
    210                         list ($counter,$tmplang) = mysql_fetch_row($res);
     204        $sth = $dbi->prepare("select counter,admlanguage from ".$prefix."_authors where aid='$aid' and pwd='$mpwd' and id_comune='$id_comune'");
     205        $sth->execute();       
     206        $row = $sth->fetch(PDO::FETCH_ASSOC);   
     207
     208                if ($sth){
     209                        $esiste=$sth->rowCount();
     210                        $counter=$row['counter'];
     211                        $tmplang=$row['admlanguage'];
    211212                        $counter+=1;
    212213                        if(strlen($tmplang)==2) $language=$tmplang;
    213                         $resup=mysql_query("update ".$prefix."_authors set counter=$counter where aid='$aid' and pwd='$mpwd' and id_comune='$id_comune'", $dbi);
     214                        $sth = $dbi->prepare("update ".$prefix."_authors set counter=$counter where aid='$aid' and pwd='$mpwd' and id_comune='$id_comune'");
     215                        $sth->execute();       
     216                        $row = $sth->fetch(PDO::FETCH_ASSOC);   
     217                       
    214218                        if ($esiste==1) {
    215219                                $_SESSION['dbi']=$dbi;
     
    221225                                $_SESSION['remote']=$_SERVER['REMOTE_ADDR'];
    222226                                $_SESSION['bgcolor1']='#ffffff';
    223                                 $_SESSION['bgcolor2']='#c5c5c5';
     227                                $_SESSION['bgcolor2']='#c5c5c5'; if (!$op) $op='consultazione';
    224228                                session_regenerate_id();
    225229                        }
     
    232236if (! isset($_SESSION['lang'])) $_SESSION['lang']=$language;
    233237$currentlang=strlen($_SESSION['lang'])==2 ? $_SESSION['lang']: $language;
    234 #if (isset($_SESSION['lang'])) $currentlang=$_SESSION['lang']; else $currentlang='it';
    235238if (isset($_SESSION['aid']))
    236239{
     
    239242$dbi=$_SESSION['dbi'];
    240243$prefix=$_SESSION['prefix'];
    241 $id_comune=$_SESSION['id_comune'];die("qui");
     244$id_comune=$_SESSION['id_comune'];
    242245if (isset($_GET['id_cons_gen'])) $id_cons_gen=intval($_GET['id_cons_gen']);
    243246else {
    244 //10/05/2009 gestione consultazione predefinita
    245         $result = mysql_query("select id_cons_gen  from ".$prefix."_ele_cons_comune where preferita='1' and (id_comune='$id_comune' or id_comune=0)", $dbi);
    246 list($id_cons_gen) = mysql_fetch_row($result);
    247 //---fine       $id_cons_gen='';
     247                        $sth = $dbi->prepare("select id_cons_gen  from ".$prefix."_ele_cons_comune where preferita='1' and (id_comune='$id_comune' or id_comune=0)");
     248                        $sth->execute();       
     249                        $row = $sth->fetch(PDO::FETCH_ASSOC);   
     250$id_cons_gen=$row[1];
    248251}
    249252$currentlang=$_SESSION['lang'];
     
    262265function ChiSei($id_cons_gen){
    263266
    264 //$server=$_SERVER['REMOTE_ADDR'];
    265 //$session=$_SESSION['remote'];
    266 //if ($session!=$server) { die ("Problema di sessione"); };
     267
    267268$aid=$_SESSION['aid'];
    268269$dbi=$_SESSION['dbi'];
     
    273274
    274275$perms=0;
    275 $result = mysql_query("select adminsuper, admincomune, adminop  from ".$prefix."_authors where aid='$aid' and pwd='$pwd' and (id_comune='$id_comune' or id_comune=0)", $dbi);
    276 list($adminsuper,$admincomune,$adminop) = mysql_fetch_row($result);
    277 //exit;
     276                        $sth = $dbi->prepare("select adminsuper, admincomune, adminop  from ".$prefix."_authors where aid='$aid' and pwd='$pwd' and (id_comune='$id_comune' or id_comune=0)");
     277                        $sth->execute();       
     278                        $row = $sth->fetch(PDO::FETCH_BOTH);   
     279
     280$adminsuper=$row[0];
     281$admincomune=$row[1];
     282$adminop=$row[2];
     283
    278284if (($adminsuper==1 || $admincomune==1 || $adminop==1)) {
    279285        if ($adminsuper==1)
    280286                return 256;
    281 //              $ressup = mysql_query("select permessi from ".$prefix."_ele_operatori where id_cons='0' and aid='$aid' and id_comune='0'",$dbi);
    282         elseif ($adminop==1)
    283                 $ressup = mysql_query("select permessi from ".$prefix."_ele_operatori where id_cons='0' and aid='$aid' and id_comune='$id_comune'",$dbi);
    284         elseif ($admincomune==1) {
    285                 $res=mysql_query("select id_cons from ".$prefix."_ele_cons_comune where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'",$dbi);
    286                 list ($id_cons)=mysql_fetch_row($res);
    287                 $ressup = mysql_query("select permessi from ".$prefix."_ele_operatori where id_cons='$id_cons' and aid='$aid' and id_comune='$id_comune'",$dbi);
     287        elseif ($adminop==1){
     288                $sth = $dbi->prepare("select permessi from ".$prefix."_ele_operatori where id_cons='0' and aid='$aid' and id_comune='$id_comune'");
     289        }elseif ($admincomune==1) {
     290                $sth = $dbi->prepare("select id_cons from ".$prefix."_ele_cons_comune where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'");
     291                        $sth->execute();       
     292                        $row = $sth->fetch(PDO::FETCH_BOTH);   
     293
     294                        $id_cons=$row[0];
     295                $sth = $dbi->prepare("select permessi from ".$prefix."_ele_operatori where id_cons='$id_cons' and aid='$aid' and id_comune='$id_comune'");
    288296        }
    289         if (mysql_num_rows($ressup)==1) list($perms)=mysql_fetch_row($ressup); else $perms=0;
     297                               
     298                        $sth->execute();       
     299                        $row = $sth->fetch(PDO::FETCH_BOTH);   
     300
     301        if ($sth->rowCount()==1) $perms=$row[0]; else $perms=0;
    290302        return $perms;
    291303} else return 0;
     
    540552    include("modules/Elezioni/ele_riepilogo.php");
    541553    break;
     554case "riepilogovoti":
     555    include("modules/Elezioni/ele_riepilogovoti.php");
     556    break;
    542557case "logout":
    543558        logout();
Note: See TracChangeset for help on using the changeset viewer.