Changeset 361 for trunk/admin/admin.php


Ignore:
Timestamp:
Mar 17, 2022, 4:12:48 PM (2 years ago)
Author:
roby
Message:

Terzo aggiornamento con modifiche per la gestione delle funzioni per cellulare oltre modifiche alla funzione di autorizzazione.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/admin.php

    r360 r361  
    1717#$LIMITE=3; //fascia di separazione del maggioritario (15.000 abitanti)
    1818# tempo di sessione: ini_set('session.gc_maxlifetime','3600');
    19 global $multicomune,$msglogout,$language;
     19global $multicomune,$msglogout,$language,$id_sez;
    2020
    2121// Adattamento variabili superglobal
     
    301301$session=$_SESSION['remote'];
    302302
    303 $perms=ChiSei($id_cons_gen); #die("qui".$_SESSION['aid']);
    304 if($perms==0) {logout();}
    305 }
     303}
     304
    306305
    307306
     
    325324$adminsuper=$row[0];
    326325$admincomune=$row[1];
    327 $adminop=$row[2];
     326$oper=$row[2];
    328327       
    329328#if (($adminsuper==1 || $admincomune==1 || $adminop==1)) {
     
    333332                return 64;
    334333#               $sth = $dbi->prepare("select permessi from ".$prefix."_ele_operatori where id_cons='0' and aid='$aid' and id_comune='$id_comune'");
    335 
    336         $sth = $dbi->prepare("select id_cons from ".$prefix."_ele_cons_comune where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'");
     334        elseif($oper) {$msglogout=1; return 0;} # id_cons='$id_cons' and
     335        else {
     336                $oggi=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-3,date("Y")));
     337                $sql="SELECT id_sez FROM ".$prefix."_ele_operatori where  aid='$aid' and permessi>0 and id_cons in (select t1.id_cons from ".$prefix."_ele_cons_comune as t1, ".$prefix."_ele_consultazione as t2 where t1.id_cons_gen=t2.id_cons_gen and t1.id_comune='$id_comune' and t2.data_fine>$oggi)";           
     338                $sth = $dbi->prepare("$sql");
     339                $sth->execute();        #die("TEST: $sql");     
     340                if($sth->rowCount()) {$perms=16; return $perms;}
     341                else {$msglogout=1; return 0;}
     342        }
     343/*      $sth = $dbi->prepare("select id_cons from ".$prefix."_ele_cons_comune where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'");
    337344        $sth->execute();       
    338345        $row = $sth->fetch(PDO::FETCH_BOTH);   
     
    340347        $sth = $dbi->prepare("select permessi from ".$prefix."_ele_operatori where id_cons='$id_cons' and aid='$aid' and id_comune='$id_comune'");
    341348               
    342         $sth->execute();       
    343         $row = $sth->fetch(PDO::FETCH_BOTH);
    344                 if($row[0]==0) $msglogout=1;
    345         if ($sth->rowCount()==1) $perms=$row[0]; else { $msglogout=1; $perms=0; }
    346 
    347         return $perms;
     349        $sth->execute();
     350        list($perms)=$sth->fetch(PDO::FETCH_NUM);
     351#       $row =  die("test:$sql".$row[0] );
     352        if (!$perms) {die("qui: select permessi from ".$prefix."_ele_operatori where id_cons='$id_cons' and aid='$aid' and id_comune='$id_comune'");    $msglogout=1; $perms=0; }
     353
     354        return $perms; */
    348355#} else return 0;
    349356}
     
    379386        elseif ($msglogout==2) echo "<h1 style=\"color:red;\">Nome Utente non presente in archivio</h1><br>";
    380387        elseif ($msglogout==3) echo "<h1 style=\"color:red;\">Password Errata</h1><br>";
     388        elseif ($msglogout==4) echo "<h1 style=\"color:red;\">Accesso non ammesso da cellulare</h1><br>";
    381389    echo "<form name=\"login\" data-ajax=\"false\" method=\"post\" action=\"admin.php\">"
    382390        ."<table class=\"table-menu\">"
     
    471479                                $tema='Futura2'; #die( "TEST id_cons:$id_cons:".$_SESSION['aid']);
    472480                                $_SESSION['tema']=$tema;
    473                         } else logout();
     481                        } #else {die("TEST: $sql"); logout();}
    474482                }
    475483        }
    476 }
    477 
     484$perms=ChiSei($id_cons_gen); #die("qui".$_SESSION['aid']);
     485if($perms==0) {logout();}
     486}
    478487
    479488#echo "op:".$param['op']." -- aid:".$_SESSION['aid']."remote:".$_SESSION['remote']."REMOTE:".$_SERVER['REMOTE_ADDR'];
Note: See TracChangeset for help on using the changeset viewer.